Package org.geowebcache.rest

Examples of org.geowebcache.rest.RestletException


                } else if (met.equals(Method.PUT)) {
                    doPut(request, response);
                } else if (met.equals(Method.DELETE)) {
                    doDelete(request, response);
                } else {
                    throw new RestletException("Method not allowed",
                        Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
                }
               
                layerDispatcher.reInit();
            }
View Full Code Here


        if(formatExtension.equalsIgnoreCase("xml")) {
            return getXMLRepresentation(tl);
        } else if(formatExtension.equalsIgnoreCase("json")) {
            return getJsonRepresentation(tl);
        } else {
            throw new RestletException("Unknown or missing format extension : " + formatExtension,
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }
    }
View Full Code Here

     */
    private void doPost(Request req, Response resp)
    throws RestletException, IOException, GeoWebCacheException {
        TileLayer tl = deserializeAndCheckLayer(req, resp, false);
        if( ! xmlConfig.modifyLayer(tl) ) {
            throw new RestletException("Layer " + tl.getName() + " is not known by the configuration."
                    + "Maybe it was loaded from another source, or you're trying to add a new "
                    + "layer and need to do an HTTP PUT ?", Status.CLIENT_ERROR_BAD_REQUEST);
        }
        layerDispatcher.reInit();
    }
View Full Code Here

        }
       
        if(testtl == null) {
            xmlConfig.addLayer(tl);
        } else {
            throw new RestletException(
            "Layer with name " + tl.getName() + " already exists, "
            +"use POST if you want to replace it.", Status.CLIENT_ERROR_BAD_REQUEST );
        }
        layerDispatcher.reInit();
    }
View Full Code Here

            new HierarchicalStreamCopier().copy(
                    hsr, new PrettyPrintWriter(writer));
            writer.close();
            newLayer = (WMSLayer) xs.fromXML(writer.toString());
        } else {
            throw new RestletException("Unknown or missing format extension: "
                    + formatExtension, Status.CLIENT_ERROR_BAD_REQUEST);
        }

        if (!newLayer.getName().equals(layerName)) {
            throw new RestletException(
                    "There is a mismatch between the name of the "
                    + " layer in the submission and the URL you specified.",
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }
View Full Code Here

                doGet(request, response);
            } else if (met.equals(Method.POST)) {
                try {
                    doPost(request, response);
                } catch (GeoWebCacheException e) {
                    throw new RestletException(e.getMessage(), Status.CLIENT_ERROR_BAD_REQUEST);
                }
            } else {
                throw new RestletException("Method not allowed",
                        Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
            }
        } catch (RestletException re) {
            response.setEntity(re.getRepresentation());
            response.setStatus(re.getStatus());
View Full Code Here

        TileLayer tl;
        try {
            tl = seeder.findTileLayer(layerName);
        } catch (GeoWebCacheException e) {
            throw new RestletException(e.getMessage(), Status.CLIENT_ERROR_BAD_REQUEST);
        }

        response.setEntity(makeFormPage(tl), MediaType.TEXT_HTML);
    }
View Full Code Here

        }

        Form form = req.getEntityAsForm();

        if (form == null) {
            throw new RestletException("Unable to parse form result.",
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }

        // String layerName = form.getFirst("layerName").getValue();

        TileLayer tl = null;
        try {
            tl = seeder.findTileLayer(layerName);
        } catch (GeoWebCacheException e) {
            throw new RestletException(e.getMessage(), Status.CLIENT_ERROR_BAD_REQUEST);
        }

        if (form.getFirst("kill_thread") != null) {
            handleKillThreadPost(form, tl, resp);
        } else if (form.getFirst("kill_all") != null) {
            handleKillAllThreadsPost(form, tl, resp);
        } else if (form.getFirst("minX") != null) {
            handleDoSeedPost(form, tl, resp);
        } else {
            throw new RestletException(
                    "Unknown or malformed request. Please try again, somtimes the form "
                            + "is not properly received. This frequently happens on the first POST "
                            + "after a restart. The POST was to " + req.getResourceRef().getPath(),
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }
View Full Code Here

        GWCTask[] tasks;
        try {
            tasks = seeder.createTasks(tr, tl, sr.getType(), sr.getThreadCount(),
                    sr.getFilterUpdate());
        } catch (GeoWebCacheException e) {
            throw new RestletException(e.getMessage(), Status.SERVER_ERROR_INTERNAL);
        }

        seeder.dispatchTasks(tasks);

        // Give the thread executor a chance to run
View Full Code Here

    }

    private static double parseDouble(Form form, String key) throws RestletException {
        String value = form.getFirst(key).getValue();
        if (value == null || value.length() == 0)
            throw new RestletException("Missing value for " + key, Status.CLIENT_ERROR_BAD_REQUEST);
        try {
            return Double.parseDouble(value);
        } catch (NumberFormatException nfe) {
            throw new RestletException("Value for " + key + " is not a double",
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }
    }
View Full Code Here

TOP

Related Classes of org.geowebcache.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.