Package org.geoserver.rest

Examples of org.geoserver.rest.RestletException


                path = path.replace(":","/");
            }
            script = scriptMgr.findOrCreateScriptFile(path);
        }
        catch(IOException e) {
            throw new RestletException(format("Error creating script file %s", path),
                Status.SERVER_ERROR_INTERNAL, e);
        }

        // copy over the contents
        try {
            BufferedWriter w = new BufferedWriter(new FileWriter(script));

            try {
                IOUtils.copy(getRequest().getEntity().getStream(), w);
                w.flush();

                //TODO: set Location header
                getResponse().setStatus(Status.SUCCESS_CREATED);
            }
            finally {
                IOUtils.closeQuietly(w);
            }
        }
        catch(IOException e) {
            throw new RestletException(format("Error writing script file %s", path),
                Status.SERVER_ERROR_INTERNAL, e);
        }
    }
View Full Code Here


            script = scriptMgr.findScriptFile(path);
            if (script == null) {
                throw new IOException(format("Unable to find script file %s", path));
            }
        } catch (IOException e) {
            throw new RestletException(format("Error finding script file %s", path),
                    Status.SERVER_ERROR_INTERNAL, e);
        }

        boolean success = false;
        if (script != null && script.exists()) {
            success = script.delete();
            if (path.startsWith("apps")) {
                success = script.getParentFile().delete();
            }
        }

        if (!success) {
            throw new RestletException(format("Error deleting script file %s", path),
                    Status.SERVER_ERROR_INTERNAL);
        }
    }
View Full Code Here

        File dir = null;
        try {
            dir = scriptMgr.findScriptDir(path);
        } catch (IOException e) {
            throw new RestletException(format("Error looking up script dir %s", path),
                    Status.SERVER_ERROR_INTERNAL, e);
        }

        List<Script> scripts = Lists.newArrayList();
        if (dir != null) {
View Full Code Here

        jsonRules = generateRulesList(layer, getRequest(), rules);

      if (jsonRules != null) {
        return jsonRules;
      } else {
        throw new RestletException("Error generating Classification!", Status.CLIENT_ERROR_BAD_REQUEST);
      }
    }
   
    return new ArrayList();
  }
View Full Code Here

       
        if ( layer != null) {
            return new ClassifierResource(getContext(),request,response,catalog);
        }
       
        throw new RestletException( "No such layer: " + layer, Status.CLIENT_ERROR_NOT_FOUND );
    }
View Full Code Here

       
        if ( layer != null) {
            return new RasterizerResource(getContext(),request,response,catalog);
        }
       
        throw new RestletException( "No such layer: " + layer, Status.CLIENT_ERROR_NOT_FOUND );
    }
View Full Code Here

        if (layer != null && request.getMethod() == Method.GET) {
            return new ListAttributesResource(getContext(), request, response,
                    catalog);
        }
   
        throw new RestletException("No such layer: " + layer,
                Status.CLIENT_ERROR_NOT_FOUND);
    }
View Full Code Here

                }
            });
            getResponse().setStatus(Status.SUCCESS_OK);
        }
        catch (Exception e) {
            throw new RestletException("Error executing script " + script.getName(),
                Status.SERVER_ERROR_INTERNAL, e);
        }
       
    }
View Full Code Here

        File pyapp;
        try {
            pyapp = resourceLoader.find(jython.getAppRoot(), app);
        } catch (IOException e) {
            throw new RestletException("Error loading app " + app,
                    Status.SERVER_ERROR_INTERNAL, e);
        }
        if (pyapp == null) {
            throw new RestletException("No such app " + app, Status.CLIENT_ERROR_NOT_FOUND);
        }
        return new PythonAppResource(jython, pyapp, request, response);
    }
View Full Code Here

       
        File pyscript;
        try {
            pyscript = resourceLoader.find(jython.getScriptRoot(), script);
        } catch (IOException e) {
            throw new RestletException("Error loading script " + script,
                    Status.SERVER_ERROR_INTERNAL, e);
        }
        if (pyscript == null) {
            throw new RestletException("No such script " + script, Status.CLIENT_ERROR_NOT_FOUND);
        }
       
        return new PythonResource(jython, pyscript, request, response);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.rest.RestletException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.