Package org.geoserver.rest

Examples of org.geoserver.rest.RestletException


            try {
                Geometry geom = new GeometryJSON().read(geometry);
                final double tolerance = getTolerance(form);
                return geometryFilter(schema, geom, tolerance);
            } catch (IOException e) {
                throw new RestletException("Could not parse the geometry geojson: "
                        + e.getMessage(), Status.CLIENT_ERROR_BAD_REQUEST);
            }
        }
    }
View Full Code Here


        } else if ("DESC".equals(order)) {
            return SortOrder.DESCENDING;
        } else if ("ASC".equals(order)) {
            return SortOrder.ASCENDING;
        } else {
            throw new RestletException("Unknown ordering direction: " + order,
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }
    }
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

        PythonInterpreter pi = python.interpreter();
        pi.execfile(appFile.getAbsolutePath());
       
        PyObject app = pi.get("app");
        if (app == null) {
            throw new RestletException("'app' function not found", Status.SERVER_ERROR_INTERNAL);
        }
        if (!(app instanceof PyFunction)) {
            throw new RestletException("'app' must be a function", Status.SERVER_ERROR_INTERNAL);
        }
       
        PyFunction appf = (PyFunction) app;
        PyFunction start_response = createStartResponse();
       
View Full Code Here

        LayerInfo layer = catalog.getLayerByName(layerName);
       
        // any of these conditions mean the layer is not currently
        // advertised in the capabilities document
        if(layer == null || !layer.isEnabled() || !(layer.getResource() instanceof FeatureTypeInfo)) {
            throw new RestletException( "No such layer: " + layerName, Status.CLIENT_ERROR_NOT_FOUND );
        }
        final FeatureTypeInfo resource = (FeatureTypeInfo) layer.getResource();
        return new DescribeResource(getContext(), request, response, resource);
    }
View Full Code Here

        String namespace = (String)req.getAttributes().get("namespace");
        String feature = (String)req.getAttributes().get("feature");
       
        NamespaceInfo ns = myCatalog.getNamespaceByPrefix(namespace);
        if ( ns == null ) {
            throw new RestletException(
                    "No such namespace:" + namespace,
                    Status.CLIENT_ERROR_NOT_FOUND
                    );
        }

        FeatureTypeInfo featureType = null;
        try {
            featureType = myCatalog.getFeatureTypeByName(ns, layer);
        } catch (NoSuchElementException e) {
            throw new RestletException(
                e.getMessage(),
                Status.CLIENT_ERROR_NOT_FOUND
            );
        }

        if (!(Boolean)featureType.getMetadata().get("indexingEnabled")){
            throw new RestletException(
                "Indexing is disabled for this layer (" + ns + ":" + layer + ") "
                + featureType.getMetadata().get("indexingEnabled"),
                Status.CLIENT_ERROR_FORBIDDEN
                );
        }

        Query q = new Query();
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        q.setFilter(ff.id(Collections.singleton(ff.featureId(feature))));

        FeatureCollection col = null;
        try {
            col = featureType.getFeatureSource(null, null).getFeatures(q);
        } catch (IOException e) {
            throw new RestletException(
                    e.getMessage(),
                    Status.SERVER_ERROR_INTERNAL
                    );
        }

        if (col.size() != 1) {
            throw new RestletException(
                "Unexpected results from data query, "
                + "should be exactly one feature with given ID",
                Status.SERVER_ERROR_INTERNAL
            );
        }
View Full Code Here

            } catch (NoSuchAuthorityCodeException ex) {
                String msg = "Invalid SRS " + srs;
                LOGGER.warning(msg + " in PUT request");
                throw ImportJSONWriter.badRequest(msg);
            } catch (FactoryException ex) {
                throw new RestletException("Error with referencing",Status.SERVER_ERROR_INTERNAL,ex);
            }
            // make this the specified native if none exists
            // useful for csv or other files
            if (resource.getNativeCRS() == null) {
                resource.setNativeCRS(newRefSystem);
View Full Code Here

        else if (MediaType.APPLICATION_WWW_FORM.equals(mimeType, true)) {
            data = handleFormPost();
        }

        if (data == null) {
            throw new RestletException("Unsupported POST", Status.CLIENT_ERROR_FORBIDDEN);
        }

        acceptData(data);
    }
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.