org.deegree.services.controller
Class OGCFrontController

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.deegree.services.controller.OGCFrontController
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class OGCFrontController
extends javax.servlet.http.HttpServlet

Servlet that acts as single HTTP communication end point and dispatcher to the OWS instances configured in the DeegreeWorkspace.

Calls to doGet(HttpServletRequest, HttpServletResponse) and doPost(HttpServletRequest, HttpServletResponse) are processed as follows:

  • The DCP-type of the incoming request is determined. This must be one of the following:
  • The responsible OWS instance is determined and one of the following methods is called:
  • Version:
    $Revision: 32084 $, $Date: 2011-10-05 10:46:15 +0200 (Wed, 05 Oct 2011) $
    Author:
    Rutger Bezema , Markus Schneider , last edited by: $Author: aschmitz $
    See Also:
    OWS, Serialized Form

    Constructor Summary
    OGCFrontController()
               
     
    Method Summary
     void destroy()
               
    protected  void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
              Handles HTTP GET requests.
    protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
              Handles HTTP POST requests.
    static RequestContext getContext()
              Returns the RequestContext associated with the calling thread.
    static String getHttpGetURL()
              Returns the HTTP URL for communicating with the OGCFrontController over the web (for GET requests).
    static String getHttpPostURL()
              Returns the HTTP URL for communicating with the OGCFrontController over the web (for POST requests).
    static OGCFrontController getInstance()
              Returns the only instance of this class.
    static WebServicesConfiguration getServiceConfiguration()
               
    static DeegreeWorkspace getServiceWorkspace()
               
     void init(javax.servlet.ServletConfig config)
               
     void reload()
              Re-initializes the whole workspace, effectively reloading the whole configuration.
     void reload(String workspaceName)
              Re-initializes the whole workspace, effectively reloading the whole configuration.
    static URL resolveFileLocation(String location, javax.servlet.ServletContext context)
              'Heuristical' method to retrieve the URL for a file referenced from an init-param of a webapp config file which may be: a (absolute) URL a file location a (relative) URL which in turn is resolved using ServletContext.getRealPath
     
    Methods inherited from class javax.servlet.http.HttpServlet
    doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
     
    Methods inherited from class javax.servlet.GenericServlet
    getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    OGCFrontController

    public OGCFrontController()
    Method Detail

    getInstance

    public static OGCFrontController getInstance()
    Returns the only instance of this class.

    Returns:
    the only instance of this class, never null
    Throws:
    RuntimeException - if GenericServlet.init() has not been called

    getContext

    public static RequestContext getContext()
    Returns the RequestContext associated with the calling thread.

    NOTE: This method will only return a correct result if the calling thread originated in the doGet(HttpServletRequest, HttpServletResponse) or doPost(HttpServletRequest, HttpServletResponse) of this class (or has been spawned as a child thread by such a thread).

    Returns:
    the RequestContext associated with the calling thread

    getServiceWorkspace

    public static DeegreeWorkspace getServiceWorkspace()
    Returns:
    the service workspace

    getServiceConfiguration

    public static WebServicesConfiguration getServiceConfiguration()
    Returns:
    the service configuration

    getHttpPostURL

    public static String getHttpPostURL()
    Returns the HTTP URL for communicating with the OGCFrontController over the web (for POST requests).

    NOTE: This method will only return a correct result if the calling thread originated in the doGet(HttpServletRequest, HttpServletResponse) or doPost(HttpServletRequest, HttpServletResponse) of this class (or has been spawned as a child thread by such a thread).

    Returns:
    the HTTP URL (for POST requests)

    getHttpGetURL

    public static String getHttpGetURL()
    Returns the HTTP URL for communicating with the OGCFrontController over the web (for GET requests).

    NOTE: This method will only return a correct result if the calling thread originated in the doGet(HttpServletRequest, HttpServletResponse) or doPost(HttpServletRequest, HttpServletResponse) of this class (or has been spawned as a child thread by such a thread).

    Returns:
    the HTTP URL (for GET requests)

    doGet

    protected void doGet(javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response)
                  throws javax.servlet.ServletException,
                         IOException
    Handles HTTP GET requests.

    An HTTP GET request implies that input parameters are specified as key-value pairs. However, at least one OGC service specification allows the sending of XML requests via GET (see WCS 1.0.0 specification, section 6.3.3). In this case, the query string contains no key=value pairs, but the (URL encoded) xml. The encoding ensures that no = char (parameter/value delimiters) occur in the string.

    Overrides:
    doGet in class javax.servlet.http.HttpServlet
    Throws:
    javax.servlet.ServletException
    IOException

    doPost

    protected void doPost(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
                   throws javax.servlet.ServletException,
                          IOException
    Handles HTTP POST requests.

    An HTTP POST request specifies parameters in the request body. OGC service specifications use three different ways to encode the parameters:

    Overrides:
    doPost in class javax.servlet.http.HttpServlet
    Throws:
    javax.servlet.ServletException
    IOException

    init

    public void init(javax.servlet.ServletConfig config)
              throws javax.servlet.ServletException
    Specified by:
    init in interface javax.servlet.Servlet
    Overrides:
    init in class javax.servlet.GenericServlet
    Throws:
    javax.servlet.ServletException

    reload

    public void reload()
                throws IOException,
                       URISyntaxException,
                       javax.servlet.ServletException
    Re-initializes the whole workspace, effectively reloading the whole configuration.

    Throws:
    URISyntaxException
    IOException
    javax.servlet.ServletException

    reload

    public void reload(String workspaceName)
                throws IOException,
                       URISyntaxException,
                       javax.servlet.ServletException
    Re-initializes the whole workspace, effectively reloading the whole configuration.

    Parameters:
    workspaceName - if not null, the specified workspace will be started after shutting down the currently running one
    Throws:
    URISyntaxException
    IOException
    javax.servlet.ServletException

    destroy

    public void destroy()
    Specified by:
    destroy in interface javax.servlet.Servlet
    Overrides:
    destroy in class javax.servlet.GenericServlet

    resolveFileLocation

    public static URL resolveFileLocation(String location,
                                          javax.servlet.ServletContext context)
                                   throws MalformedURLException
    'Heuristical' method to retrieve the URL for a file referenced from an init-param of a webapp config file which may be:

    Parameters:
    location -
    context -
    Returns:
    the full (and whitespace-escaped) URL
    Throws:
    MalformedURLException


    Copyright © 2011. All Rights Reserved.