Class AbstractWFSResponseFactory
Object
AbstractWFSResponseFactory
- All Implemented Interfaces:
WFSResponseFactory
- Direct Known Subclasses:
AbstractGetFeatureResponseParserFactory,TransactionResponseFactory
Potential base class for
WFSResponseFactory implementations. Provides support for detecting and parsing of
exception reports received as HTTPResponse.
Subclasses have to CommonPlugin.Implementation isValidResponseHead(java.lang.String) and createResponseImpl(WFSRequest, HTTPResponse, InputStream).
- Author:
- awaterme
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateResponse(WFSRequest request, HTTPResponse response) Returns either a properly parsed response object or an exception depending on what the server returned.protected abstract WFSResponsecreateResponseImpl(WFSRequest request, HTTPResponse response, InputStream in) Has to be implemented to turn the request and response into a properWFSResponse.protected abstract booleanisValidResponseHead(String head) parseException(WFSRequest originatingRequest, InputStream inputStream) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface WFSResponseFactory
canProcess, canProcess, getSupportedOutputFormats, isAvailable
-
Constructor Details
-
AbstractWFSResponseFactory
public AbstractWFSResponseFactory()
-
-
Method Details
-
createResponse
public WFSResponse createResponse(WFSRequest request, HTTPResponse response) throws IOException, ServiceException 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:
createResponsein interfaceWFSResponseFactoryresponse- the handle to the response contents the WFS sent- Returns:
- a
WFSResponsethat can deal with the given request and response - Throws:
IOExceptionServiceException- See Also:
-
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 properWFSResponse.- 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
- 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
-