Class AbstractWFSResponseFactory
- Object
-
- AbstractWFSResponseFactory
-
- All Implemented Interfaces:
WFSResponseFactory
- Direct Known Subclasses:
AbstractGetFeatureResponseParserFactory,TransactionResponseFactory
public abstract class AbstractWFSResponseFactory extends Object implements WFSResponseFactory
Potential base class forWFSResponseFactoryimplementations. Provides support for detecting and parsing of exception reports received asHTTPResponse.Subclasses have to
CommonPlugin.ImplementationisValidResponseHead(java.lang.String)andcreateResponseImpl(WFSRequest, HTTPResponse, InputStream).- Author:
- awaterme
-
-
Constructor Summary
Constructors Constructor Description AbstractWFSResponseFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description WFSResponsecreateResponse(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)WFSExceptionparseException(WFSRequest originatingRequest, InputStream inputStream)-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface WFSResponseFactory
canProcess, canProcess, getSupportedOutputFormats, isAvailable
-
-
-
-
Method Detail
-
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:
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 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
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
-
-