Package org.vfny.geoserver.wms

Examples of org.vfny.geoserver.wms.WmsException


                }
            }

            if (errors.size() != 0) {
                in = new FileInputStream(f);
                throw new WmsException(GETMAPValidator.getErrorMessage(in,
                        errors));
            }
        } catch (IOException e) {
            String msg = "Creating remote GETMAP url: " + e.getMessage();
            LOGGER.log(Level.WARNING, msg, e);
            throw new WmsException(e, msg, "GETMAP validator");
        }
    }
View Full Code Here


            ParserAdapter adapter = new ParserAdapter(parser.getParser());
            adapter.setContentHandler(currentRequest);
            adapter.parse(requestSource);
            LOGGER.fine("just parsed: " + requestSource);
        } catch (SAXException e) {
            throw new WmsException(e, "XML capabilities request parsing error",
                getClass().getName());
        } catch (IOException e) {
            throw new WmsException(e, "XML capabilities request input error",
                getClass().getName());
        } catch (ParserConfigurationException e) {
            throw new WmsException(e, "Some sort of issue creating parser",
                getClass().getName());
        }

        Request r = currentRequest.getRequest(req);
        return r;
View Full Code Here

        LOGGER.fine(layers.toString());

        int layerCount = layers.size();

        if (layerCount == 0) {
            throw new WmsException("No LAYERS has been requested",
                getClass().getName());
        }

        Data catalog = req.getWMS().getData();
        LOGGER.fine(catalog.toString());

        String layerName = null;
        FeatureTypeInfo ftype = null;

        try {
            LOGGER.fine("looking featuretypeinfos");

            for (int i = 0; i < layerCount; i++) {
                layerName = (String) layers.get(i);
                LOGGER.fine("Looking for layer " + layerName);
                ftype = catalog.getFeatureTypeInfo(layerName);
                req.addLayer(ftype);
                LOGGER.fine(layerName + " found");
            }
        } catch (NoSuchElementException ex) {
            throw new WmsException(ex,
                layerName + ": no such layer on this server", "LayerNotDefined");
        }

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("parsed request " + req);
View Full Code Here

            getFInfoFilter = filterFac.createGeometryFilter(AbstractFilter.GEOMETRY_INTERSECTS);
            getFInfoFilter.addLeftGeometry(filterFac.createLiteralExpression(
                    pixelRect));
        } catch (IllegalFilterException e) {
            e.printStackTrace();
            throw new WmsException(null, "Internal error : " + e.getMessage());
        }

        int layerCount = requestedLayers.length;
        results = new ArrayList(layerCount);
        metas = new ArrayList(layerCount);

       
        try {
            for (int i = 0; i < layerCount; i++) {
                FeatureTypeInfo finfo = requestedLayers[i];
                Query q = new DefaultQuery( finfo.getTypeName(), null, getFInfoFilter,request.getFeatureCount(), Query.ALL_NAMES, null );
                FeatureResults match = finfo.getFeatureSource().getFeatures(q);

                //this was crashing Gml2FeatureResponseDelegate due to not setting
                //the featureresults, thus not being able of querying the SRS
                //if (match.getCount() > 0) {
                    results.add(match);
                    metas.add(finfo);
                //}
            }
        } catch (IOException ioe) {
            ioe.printStackTrace();
            throw new WmsException(null, "Internal error : " + ioe.getMessage());
        }
    }
View Full Code Here

            HttpSession session = request.getSession();
            ServletContext context = session.getServletContext();

            GeoServer geoServer = (GeoServer) context.getAttribute(GeoServer.WEB_CONTAINER_KEY);
           
            WmsException wmse = new WmsException(message);
            String tempResponse = wmse.getXmlResponse(geoServer.isVerboseExceptions(), request);

            response.setContentType(geoServer.getCharSet().toString());
            response.getWriter().write(tempResponse);
        }
    }
View Full Code Here

                layerQuery = new DefaultQuery(schema.getTypeName(),
                        finalLayerFilter, props);
                queries[i] = layerQuery;
            }
        } catch (IllegalFilterException ex) {
            throw new WmsException(ex,
                "Can't build layer queries: " + ex.getMessage(),
                getClass().getName() + "::parseFilters");
        } catch (java.io.IOException e) {
            throw new WmsException(e);
        }

        return queries;
    }
View Full Code Here

          try {
            CoordinateReferenceSystem  mapcrs = CRS.decode(epsgCode);
            request.setCrs(mapcrs);
          }catch (Exception e){
            //couldnt make it - we send off a service exception with the correct info
            throw new WmsException(e.getLocalizedMessage(), "InvalidSRS");
      }
        }

        String transparentValue = getValue("TRANSPARENT");
        boolean transparent = (transparentValue == null) ? false
                                                         : Boolean.valueOf(transparentValue)
                                                                  .booleanValue();
        request.setTransparent(transparent);

        String bgcolor = getValue("BGCOLOR");

        if (bgcolor != null) {
            try {
                request.setBgColor(Color.decode(bgcolor));
            } catch (NumberFormatException nfe) {
                throw new WmsException("BGCOLOR " + bgcolor
                    + " incorrectly specified (0xRRGGBB format expected)");
            }
        }
    }
View Full Code Here

            int width = Integer.parseInt(getValue("WIDTH"));
            int height = Integer.parseInt(getValue("HEIGHT"));
            request.setWidth(width);
            request.setHeight(height);
        } catch (NumberFormatException ex) {
            throw new WmsException("WIDTH and HEIGHT incorrectly specified");
        }

        String format = getValue("FORMAT");

        if (format == null) {
            throw new WmsException("parameter FORMAT is required");
        }

        request.setFormat(format);

        Envelope bbox = parseBbox();
View Full Code Here

        //raw list of attributes for each feature type requested
        List byFeatureTypes = readFlat(rawAtts, "|");
        int nLayers = layers.length;

        if (byFeatureTypes.size() != nLayers) {
            throw new WmsException(byFeatureTypes.size()
                + " lists of attributes specified, expected " + layers.length,
                getClass().getName() + "::parseAttributes()");
        }

        //fill byFeatureTypes with the split of its raw attributes requested
        //separated by commas, and check for the validity of each att name
        for (int i = 0; i < nLayers; i++) {
            rawAtts = (String) byFeatureTypes.get(i);

            List atts = readFlat(rawAtts, ",");
            byFeatureTypes.set(i, atts);

            //FeatureType schema = layers[i].getSchema();
            try {
                FeatureType schema = layers[i].getFeatureType();

                //verify that propper attributes has been requested
                for (Iterator attIt = atts.iterator(); attIt.hasNext();) {
                    String attName = (String) attIt.next();

                    if (attName.length() > 0) {
                        LOGGER.finer("checking that " + attName + " is valid");

                        if ("#FID".equalsIgnoreCase(attName)
                                || "#BOUNDS".equalsIgnoreCase(attName)) {
                            LOGGER.finer("special attribute name requested: "
                                + attName);

                            continue;
                        }

                        if (schema.getAttributeType(attName) == null) {
                            throw new WmsException("Attribute '" + attName
                                + "' requested for layer "
                                + schema.getTypeName() + " does not exists");
                        }
                    } else {
                        LOGGER.finest(
                            "removing empty attribute name from request");
                        attIt.remove();
                    }
                }

                LOGGER.finest("attributes requested for "
                    + schema.getTypeName() + " checked: " + rawAtts);
            } catch (java.io.IOException e) {
                throw new WmsException(e);
            }
        }

        return byFeatureTypes;
    }
View Full Code Here

        Envelope bbox = null;
        String bboxParam = getValue("BBOX");
        Object[] bboxValues = readFlat(bboxParam, INNER_DELIMETER).toArray();

        if (bboxValues.length != 4) {
            throw new WmsException(bboxParam
                + " is not a valid pair of coordinates", getClass().getName());
        }

        try {
            double minx = Double.parseDouble(bboxValues[0].toString());
            double miny = Double.parseDouble(bboxValues[1].toString());
            double maxx = Double.parseDouble(bboxValues[2].toString());
            double maxy = Double.parseDouble(bboxValues[3].toString());
            bbox = new Envelope(minx, maxx, miny, maxy);

            if (minx > maxx) {
                throw new WmsException("illegal bbox, minX: " + minx + " is "
                    + "greater than maxX: " + maxx);
            }

            if (miny > maxy) {
                throw new WmsException("illegal bbox, minY: " + miny + " is "
                    + "greater than maxY: " + maxy);
            }
        } catch (NumberFormatException ex) {
            throw new WmsException(ex,
                "Illegal value for BBOX parameter: " + bboxParam,
                getClass().getName() + "::parseBbox()");
        }

        return bbox;
View Full Code Here

TOP

Related Classes of org.vfny.geoserver.wms.WmsException

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.