public class TLcdOGCCommandDispatcher extends ALcdOGCCommandDispatcher
ALcdOGCCommandDispatcher
. Most
applications will want to extend this class rather than rewriting it
entirely.Modifier and Type | Field and Description |
---|---|
protected static String |
REQUEST |
protected static String |
SERVICE |
Constructor and Description |
---|
TLcdOGCCommandDispatcher() |
Modifier and Type | Method and Description |
---|---|
protected ILcdRequestHandler |
getRequestHandler(String aService,
String aRequest)
Finds the registered handler for the given service and request, if any.
|
void |
handleRequest(ILcdRequest aRequest,
ILcdResponse aResponse)
Handles a request.
|
protected void |
handleServiceException(ILcdResponse aResponse,
TLcdOGCServiceException aException,
ILcdRequest aRequest)
Handles a service exception.
|
protected void |
handleUnknownRequest(String aRequest)
Called if no request handler can be found for the given request.
|
void |
registerRequestHandler(String aService,
String aRequest,
ILcdRequestHandler aHandler)
Registers a new request handler.
|
protected String |
validateService(String aService,
String aRequestType,
ILcdRequest aRequest)
This method allows implementations to validate the "service" parameter of a request.
|
dispose
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
protected static final String REQUEST
protected static final String SERVICE
public void handleRequest(ILcdRequest aRequest, ILcdResponse aResponse) throws IOException
ALcdOGCCommandDispatcher
handleRequest
in class ALcdOGCCommandDispatcher
aRequest
- the request which may be a KVP request or a XML request or ...aResponse
- the response to encode the result into.IOException
- if the request handling fails.protected String validateService(String aService, String aRequestType, ILcdRequest aRequest) throws TLcdOGCServiceException
aService
- the service parameter to validate, e.g. WFSaRequestType
- the name of the request type, e.g. GetCapabilitiesaRequest
- the original request from which the service parameter has been extractedaService
or a default value that
should be used if aService
is not correct.TLcdOGCServiceException
- in case the parameter is invalid.protected void handleServiceException(ILcdResponse aResponse, TLcdOGCServiceException aException, ILcdRequest aRequest)
aResponse
- The response to which the service exception can be encodedaException
- The service exception to handleaRequest
- The original request that triggered the service exceptionprotected void handleUnknownRequest(String aRequest) throws TLcdOGCServiceException
TLcdOGCServiceException.UNKNOWN_REQUEST
; this triggers a call to handleServiceException(com.luciad.ogc.common.ILcdResponse, com.luciad.ogc.common.TLcdOGCServiceException, com.luciad.ogc.common.ILcdRequest)
, which by default results in the encoding of an XML service exception
report that is sent to the client.aRequest
- The value of the request parameter REQUEST
TLcdOGCServiceException
- if a service exception report should be generated and sent to
the clientprotected ILcdRequestHandler getRequestHandler(String aService, String aRequest)
null
is returned.aService
- The value of the request parameter SERVICE
aRequest
- The value of the request parameter REQUEST
null
if no
handler is foundpublic void registerRequestHandler(String aService, String aRequest, ILcdRequestHandler aHandler)
registerRequestHandler
in class ALcdOGCCommandDispatcher
aService
- The name of the service for which this request handler is valid, e.g. "WCS".aRequest
- The name of the request for which the handler is to be used, e.g.
"GetCapabilities".aHandler
- An ILcdRequestHandler
.