Package org.geowebcache.service

Examples of org.geowebcache.service.HttpErrorCodeException


            }
            if (name != null && name.length() == 0) {
                name = null;
            }
            if (name == null) {// name is mandatory
                throw new HttpErrorCodeException(HttpServletResponse.SC_BAD_REQUEST,
                        "Layer name not provided");
            }
            LayerInfo layer = null;
            LayerGroupInfo layerGroup = null;
            if (id != null) {
                layer = catalog.getLayer(id);
                if (layer == null) {
                    layerGroup = catalog.getLayerGroup(id);
                    if (layerGroup == null) {
                        throw new HttpErrorCodeException(HttpServletResponse.SC_BAD_REQUEST,
                                "No GeoServer Layer or LayerGroup exists with id '" + id + "'");
                    }
                }
            } else {
                layer = catalog.getLayerByName(name);
                if (layer == null) {
                    layerGroup = catalog.getLayerGroupByName(name);
                    if (layerGroup == null) {
                        throw new HttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND,
                                "GeoServer Layer or LayerGroup '" + name + "' not found");
                    }
                }
            }

            final String actualId = layer != null ? layer.getId() : layerGroup.getId();
            final String actualName = layer != null ? GWC.tileLayerName(layer) : GWC
                    .tileLayerName(layerGroup);

            if (id != null && !name.equals(actualName)) {
                throw new HttpErrorCodeException(HttpServletResponse.SC_BAD_REQUEST,
                        "Layer with id '" + id + "' found but name does not match: '" + name
                                + "'/'" + actualName + "'");
            }

            info.setId(actualId);
View Full Code Here

TOP

Related Classes of org.geowebcache.service.HttpErrorCodeException

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.