Package org.vfny.geoserver.wms

Examples of org.vfny.geoserver.wms.WmsException


        ByteArrayOutputStream out = new ByteArrayOutputStream();

        try {
            transformer.transform(request, out);
        } catch (TransformerException e) {
            throw new WmsException(e);
        }

        this.rawResponse = out.toByteArray();
    }
View Full Code Here


            kmlEncoder.encode(bos);
            bos.flush();
            bos.close();
           
        } catch(IOException ioe){
            WmsException we  = new WmsException(ioe.getMessage());
            we.initCause(ioe);
            throw we;
        }
    }
View Full Code Here

    request.setHttpServletRequest(httpRequest);

    String version = super.getRequestVersion();

    if (!GetLegendGraphicRequest.SLD_VERSION.equals(version)) {
      throw new WmsException("Invalid SLD version number \"" + version
          + "\"");
    }

    String layer = getValue("LAYER");
    FeatureTypeInfo fti;
    FeatureType ft;

    try {
      WMS wms = request.getWMS();
      Data catalog = wms.getData();
      fti = catalog.getFeatureTypeInfo(layer);
      ft = fti.getFeatureType();
    } catch (NoSuchElementException e) {
      throw new WmsException(layer + " layer does not exists.",
          "LayerNotDefined");
    } catch (IOException e) {
      throw new WmsException(
          "Can't obtain the schema for the required layer.");
    }

    request.setLayer(ft);

    String format = getValue("FORMAT");

    if (!org.vfny.geoserver.wms.responses.GetLegendGraphicResponse
        .supportsFormat(format)) {
      throw new WmsException("Invalid graphic format: " + format,
          "InvalidFormat");
    }

    request.setFormat(format);
View Full Code Here

    try {
      URL url = new URL(sldUrl);
      in = url.openStream();
    } catch (MalformedURLException e) {
      throw new WmsException(e, "Not a valid URL to an SLD document "
          + sldUrl, "loadRemoteStyle");
    } catch (IOException e) {
      throw new WmsException(e, "Can't open the SLD URL " + sldUrl,
          "loadRemoteStyle");
    }

    return parseSld(new InputStreamReader(in));
  }
View Full Code Here

    Style[] styles = null;

    try {
      styles = parser.readXML();
    } catch (RuntimeException e) {
      throw new WmsException(e);
    }

    if ((styles == null) || (styles.length == 0)) {
      throw new WmsException("Document contains no styles");
    }

    return styles;
  }
View Full Code Here

          }
        }
      }

      if (sldRule == null) {
        throw new WmsException("Style " + sldStyle.getName()
            + " does not contains a rule named " + rule);
      }
    }

    return sldRule;
View Full Code Here

         //. Another workaround to this DTD problem is to simply remove (or comment out) the <!DOCTYPE> declaration from the web.xml file you process with ListServlets1./
        //
         //also see:
         //http://doctypechanger.sourceforge.net/
         //J+
            throw new WmsException("unknown host - "
                + unh.getLocalizedMessage()
                + " - if its in a !DOCTYPE, remove the !DOCTYPE tag.");
        } catch (SAXParseException se) {
            throw new WmsException("line " + se.getLineNumber() + " column "
                + se.getColumnNumber() + " -- " + se.getLocalizedMessage());
        } catch (Exception e) {
            throw new WmsException(e);
        }

        return getMapRequest;
    }
View Full Code Here

        StyledLayerDescriptor sld) throws Exception {
        final StyledLayer[] styledLayers = sld.getStyledLayers();
        final int slCount = styledLayers.length;

        if (slCount == 0) {
            throw new WmsException("SLD document contains no layers");
        }

        final List layers = new ArrayList();
        final List styles = new ArrayList();
        FeatureTypeInfo currLayer;
        Style currStyle;

        StyledLayer sl = null;

        for (int i = 0; i < slCount; i++) {
            sl = styledLayers[i];

            String layerName = sl.getName();

            if (null == layerName) {
                throw new WmsException(
                    "A UserLayer without layer name was passed");
            }

            // TODO: add support for remote WFS here
            //handle the InLineFeature stuff
View Full Code Here

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

                }
            }

            if (errors.size() != 0) {
                in = new FileInputStream(f);
                throw new WmsException(SLDValidator.getErrorMessage(in, errors));
            }
        } catch (IOException e) {
            String msg = "Creating remote SLD url: " + e.getMessage();
            LOGGER.log(Level.WARNING, msg, e);
            throw new WmsException(e, msg, "parseSldParam");
        }
    }
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.