Class TLcdOGCCommandDispatcher

java.lang.Object
com.luciad.ogc.common.ALcdOGCCommandDispatcher
com.luciad.ogc.common.TLcdOGCCommandDispatcher
All Implemented Interfaces:
ILcdDisposable, AutoCloseable
Direct Known Subclasses:
TLcdWCSCommandDispatcher, TLcdWFSCommandDispatcher

public class TLcdOGCCommandDispatcher extends ALcdOGCCommandDispatcher
A basic implementation of ALcdOGCCommandDispatcher. Most applications will want to extend this class rather than rewriting it entirely.
  • Field Details

  • Constructor Details

    • TLcdOGCCommandDispatcher

      public TLcdOGCCommandDispatcher()
  • Method Details

    • handleRequest

      public void handleRequest(ILcdRequest aRequest, ILcdResponse aResponse) throws IOException
      Description copied from class: ALcdOGCCommandDispatcher
      Handles a request.
      Specified by:
      handleRequest in class ALcdOGCCommandDispatcher
      Parameters:
      aRequest - the request which may be a KVP request or a XML request or ...
      aResponse - the response to encode the result into.
      Throws:
      IOException - if the request handling fails.
    • validateService

      protected String validateService(String aService, String aRequestType, ILcdRequest aRequest) throws TLcdOGCServiceException
      This method allows implementations to validate the "service" parameter of a request. If the parameter is incorrect, and there is no applicable default value, an exception describing the problem should be thrown.

      Specific implementations can choose when an exception is to be thrown and when a default value is returned. The default implementation is optimized for WFS compliancy, which results in exceptions in some cases and default values in other cases. Parameters that influence the result are the version and operation name, if they can be derived from the request.

      This method can be implemented by specific services to improve exception reporting.

      Parameters:
      aService - the service parameter to validate, e.g. WFS
      aRequestType - the name of the request type, e.g. GetCapabilities
      aRequest - the original request from which the service parameter has been extracted
      Returns:
      The name of the service, which is either aService or a default value that should be used if aService is not correct.
      Throws:
      TLcdOGCServiceException - in case the parameter is invalid.
    • handleServiceException

      protected void handleServiceException(ILcdResponse aResponse, TLcdOGCServiceException aException, ILcdRequest aRequest)
      Handles a service exception.
      Parameters:
      aResponse - The response to which the service exception can be encoded
      aException - The service exception to handle
      aRequest - The original request that triggered the service exception
    • handleUnknownRequest

      protected void handleUnknownRequest(String aRequest) throws TLcdOGCServiceException
      Called if no request handler can be found for the given request. By default, an exception is thrown of type 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.
      Parameters:
      aRequest - The value of the request parameter REQUEST
      Throws:
      TLcdOGCServiceException - if a service exception report should be generated and sent to the client
    • getRequestHandler

      protected ILcdRequestHandler getRequestHandler(String aService, String aRequest)
      Finds the registered handler for the given service and request, if any. If no handler is found, null is returned.
      Parameters:
      aService - The value of the request parameter SERVICE
      aRequest - The value of the request parameter REQUEST
      Returns:
      the registered handler for the given service and request, or null if no handler is found
    • registerRequestHandler

      public void registerRequestHandler(String aService, String aRequest, ILcdRequestHandler aHandler)
      Registers a new request handler.
      Specified by:
      registerRequestHandler in class ALcdOGCCommandDispatcher
      Parameters:
      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.