Package org.geowebcache.rest

Examples of org.geowebcache.rest.RestletException


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


        if(formatExtension.equalsIgnoreCase("xml")) {
            sr = (SeedRequest) xs.fromXML(req.getEntity().getStream());
        } else if(formatExtension.equalsIgnoreCase("json")){
            sr = (SeedRequest) xs.fromXML(convertJson(req.getEntity().getText()));
        } else {
            throw new RestletException("Format extension unknown or not specified: "
                    + formatExtension,
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }
       
        String layerName = null;
        try {
            layerName = URLDecoder.decode((String) req.getAttributes().get("layer"), "UTF-8");
        } catch (UnsupportedEncodingException uee) { }
       
       
        try {
            seeder.seed(layerName, sr);
        }catch(IllegalArgumentException e){
            throw new RestletException(e.getMessage(), Status.CLIENT_ERROR_BAD_REQUEST);
        } catch (GeoWebCacheException e) {
            throw new RestletException(e.getMessage(), Status.SERVER_ERROR_INTERNAL);
        }

    }
View Full Code Here

        try {
            if (met.equals(Method.GET)) {
                doGet(request, response);
            } else {

                throw new RestletException("Method not allowed",
                        Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
            }

        } catch (RestletException re) {
            response.setEntity(re.getRepresentation());
View Full Code Here

    protected Representation doGetInternal(String layerName, String gridSetId, String type)
    throws RestletException {
        TileLayer tl = findTileLayer(layerName, layerDispatcher);
  
        if(tl == null) {
            throw new RestletException(layerName + " is not known", Status.CLIENT_ERROR_NOT_FOUND);
        }
       
        GridSubset grid = tl.getGridSubset(gridSetId);
       
        if(grid == null) {
            throw new RestletException(layerName + " does not support " + gridSetId, Status.CLIENT_ERROR_NOT_FOUND);
        }
       
        StringBuilder str = new StringBuilder();
        long[][] bounds = grid.getCoverages();
       
        if(type.equalsIgnoreCase("java")) {
            str.append("{");
            for(int i=0; i<bounds.length; i++) {
                str.append("{");
               
                for(int j=0; j<bounds[i].length; j++) {
                    str.append(bounds[i][j]);
                   
                    if(j+1 < bounds[i].length) {
                        str.append(", ");
                    }
                }
               
                str.append("}");
               
                if(i+1 < bounds.length) {
                    str.append(", ");
                }      
            }
            str.append("}");
           
            return new StringRepresentation(str.toString(), MediaType.TEXT_PLAIN);
        } else {
            throw new RestletException("Unknown or missing format extension : " + type,
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }
    }
View Full Code Here

    public void handle(Request request, Response response) {
        Method met = request.getMethod();
        if (met.equals(Method.GET)) {
            doGet(request, response);
        } else {
            throw new RestletException("Method not allowed", Status.CLIENT_ERROR_METHOD_NOT_ALLOWED);
        }
    }
View Full Code Here

                } 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);
                }
            }
        } catch (RestletException re) {
            response.setEntity(re.getRepresentation());
View Full Code Here

                        UnmarshallingContext context) {
                    throw new UnsupportedOperationException();
                }
            });
        } else if (extension.equalsIgnoreCase("html")) {
            throw new RestletException("Unknown or missing format extension : " + extension,
                    Status.CLIENT_ERROR_BAD_REQUEST);
        } else {
            throw new RestletException("Unknown or missing format extension : " + extension,
                    Status.CLIENT_ERROR_BAD_REQUEST);
        }

        return representation;
    }
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

        try {
            Configuration configuration = layerDispatcher.modify(tl);
            configuration.save();
        } catch (IllegalArgumentException e) {
            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);
        }
    }
View Full Code Here

        if (testtl == null) {
            Configuration config = layerDispatcher.addLayer(tl);
            config.save();
        } else {
            throw new RestletException("Layer with name " + tl.getName() + " already exists, "
                    + "use POST if you want to replace it.", 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.