public abstract class AbstractWFSResponseFactory extends Object implements WFSResponseFactory
WFSResponseFactory
implementations. Provides support for
detecting and parsing of exception reports received as HTTPResponse
.
Subclasses have to CommonPlugin.Implementation
#isValidResponseHead(StringBuilder)
and
createResponseImpl(WFSRequest, HTTPResponse, InputStream)
.
Constructor and Description |
---|
AbstractWFSResponseFactory() |
Modifier and Type | Method and Description |
---|---|
WFSResponse |
createResponse(WFSRequest request,
HTTPResponse response)
Returns either a properly parsed response object or an exception depending on what the server
returned.
|
protected abstract WFSResponse |
createResponseImpl(WFSRequest request,
HTTPResponse response,
InputStream in)
Has to be implemented to turn the request and response into a proper
WFSResponse . |
protected abstract boolean |
isValidResponseHead(String head) |
WFSException |
parseException(WFSRequest originatingRequest,
InputStream inputStream) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canProcess, canProcess, getSupportedOutputFormats, isAvailable
public WFSResponse createResponse(WFSRequest request, HTTPResponse response) throws IOException
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.
createResponse
in interface WFSResponseFactory
response
- the handle to the response contents the WFS sentWFSResponseParser
that can deal with the given WFS responseIOException
WFSResponseFactory#createParser(WFSResponse)
,
FeatureCollectionParser
,
ExceptionReportParser
protected abstract WFSResponse createResponseImpl(WFSRequest request, HTTPResponse response, InputStream in) throws IOException
WFSResponse
.request
- response
- in
- The stream to read the response from. It is safe not to close this stream
explicitly but to dispose the response instead.IOException
protected abstract boolean isValidResponseHead(String head)
head
- The first couple of characters from the response, typically the first 512public WFSException parseException(WFSRequest originatingRequest, InputStream inputStream) throws IOException
originatingRequest
- inputStream
- WFSException
IOException
- in case the parsing of the exception report failedCopyright © 1996–2019 Geotools. All rights reserved.