Class WmsServlet

    • Field Detail

      • DEFAULT_SUPPORTED_CRS_CODES

        protected static final String[] DEFAULT_SUPPORTED_CRS_CODES
      • velocityEngine

        protected final org.apache.velocity.app.VelocityEngine velocityEngine
    • Constructor Detail

      • WmsServlet

        public WmsServlet()
        See Also:
        HttpServlet()
    • Method Detail

      • setCatalogue

        public void setCatalogue​(WmsCatalogue catalogue)
        Sets a WmsCatalogue to be used globally for all requests. If no catalogue is set and this Servlet is used then it will fail with a NullPointerException on the vast majority of calls. Note that this WmsCatalogue is only used in the WmsServlet#dispatchWmsRequest(String, RequestParams, HttpServletRequest, HttpServletResponse) method, which passes it to all of the worker methods. Thus, a different WmsCatalogue can be used for each request if required (for example to have dataset/variable defined by the URL) by subclassing WmsServlet and overriding WmsServlet#dispatchWmsRequest(String, RequestParams, HttpServletRequest, HttpServletResponse) such that it passes a new catalogue to each of those methods
        Parameters:
        catalogue - The WmsCatalogue to use.
      • getCatalogue

        protected WmsCatalogue getCatalogue()
        Gets the WmsCatalogue used in this servlet. Subclasses may wish to use this method to get direct access to the catalogue if (for example) implementing new, non-WMS extensions.
        Returns:
        The WmsCatalogue associated with this servlet.
      • setCapabilitiesAdvertisedPalettes

        protected void setCapabilitiesAdvertisedPalettes​(Collection<String> paletteNames)
        Sets the palettes to be advertised in the GetCapabilities document. In the capabilities document, each layer will advertise the available styles. Since some styles can use palettes, this means that the capabilities document can get very large very quickly with the formula: (styles which use palettes) x (number of palettes) x (number of layers) being an approximation of how many Style tags are defined in the document. This is impractical, so we limit the number of advertised palettes. By default, this will only include the default palette name. This method takes a List of palette names to advertise alongside the default.
        Parameters:
        paletteNames - The palettes to advertise alongside the default.
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest httpServletRequest,
                             javax.servlet.http.HttpServletResponse httpServletResponse)
                      throws javax.servlet.ServletException,
                             IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
        See Also:
        HttpServlet.doGet(HttpServletRequest request, HttpServletResponse response)
      • dispatchWmsRequest

        protected void dispatchWmsRequest​(String request,
                                          RequestParams params,
                                          javax.servlet.http.HttpServletRequest httpServletRequest,
                                          javax.servlet.http.HttpServletResponse httpServletResponse,
                                          WmsCatalogue catalogue)
                                   throws Exception
        Sends the HTTP request to the appropriate WMS method
        Parameters:
        request - The URL REQUEST parameter
        params - A map of URL parameters, implemented in a case-insensitive way
        httpServletRequest - The HttpServletRequest object from the GET request
        httpServletResponse - The HttpServletResponse object from the GET request
        catalogue - The WmsCatalogue which should be used to serve datasets.
        Throws:
        Exception
      • getMetadata

        protected void getMetadata​(RequestParams params,
                                   javax.servlet.http.HttpServletResponse httpServletResponse,
                                   WmsCatalogue catalogue)
                            throws MetadataException
        Handles returning metadata about a requested layer.
        Parameters:
        params - The URL parameters
        httpServletResponse - The response object to write out to
        catalogue2 -
        Throws:
        MetadataException - If there are any issues with returning the metadata
      • extractSectionElevation

        protected Extent<Double> extractSectionElevation​(String depthString)
      • handleWmsException

        protected void handleWmsException​(EdalException exception,
                                          javax.servlet.http.HttpServletResponse httpServletResponse,
                                          boolean v130)
                                   throws IOException
        Wraps EdalExceptions in an XML wrapper and returns them.
        Parameters:
        exception - The exception to handle
        httpServletResponse - The HttpServletResponse object to write to
        v130 - Whether this should be handled as a WMS v1.3.0 exception
        Throws:
        IOException - If there is a problem writing to the output stream
      • setCrsCodes

        public void setCrsCodes​(String[] SupportedCrsCodes)
      • getCrsCodes

        public String[] getCrsCodes()