Class AbstractWFSResponseFactory

    • Constructor Detail

      • AbstractWFSResponseFactory

        public AbstractWFSResponseFactory()
    • Method Detail

      • createResponse

        public WFSResponse createResponse​(WFSRequest request,
                                          HTTPResponse response)
                                   throws IOException
        Returns either a properly parsed response object or an exception depending on what the server returned.

        Ideally, the decision should only be taken based on the WFS response's content-type HTTP header. Truth is, some WFS implementations does not set proper HTTP response headers so a bit of an heuristic may be needed in order to identify the actual response.

        Specified by:
        createResponse in interface WFSResponseFactory
        response - the handle to the response contents the WFS sent
        Returns:
        a WFSResponse that can deal with the given request and response
        Throws:
        IOException
        See Also:
        WFSResponseFactory.createResponse(WFSRequest, HTTPResponse), WFSException
      • createResponseImpl

        protected abstract WFSResponse createResponseImpl​(WFSRequest request,
                                                          HTTPResponse response,
                                                          InputStream in)
                                                   throws IOException
        Has to be implemented to turn the request and response into a proper WFSResponse.
        Parameters:
        in - The stream to read the response from. It is safe not to close this stream explicitly but to dispose the response instead.
        Returns:
        The actual response
        Throws:
        IOException
      • isValidResponseHead

        protected abstract boolean isValidResponseHead​(String head)
        Parameters:
        head - The first couple of characters from the response, typically the first 512
        Returns:
        true, if head is an indicator for the expected XML result structure.
      • parseException

        public WFSException parseException​(WFSRequest originatingRequest,
                                           InputStream inputStream)
                                    throws IOException
        Returns:
        An WFSException
        Throws:
        IOException - in case the parsing of the exception report failed