NextApp Echo3
v3.0.b4

nextapp.echo.webcontainer
Class WebContainerServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by nextapp.echo.webcontainer.WebContainerServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class WebContainerServlet
extends javax.servlet.http.HttpServlet

Web container HttpServlet implementation. An Echo application should provide an derivative of this class which is registered in the web application deployment descriptor.

See Also:
Serialized Form

Nested Class Summary
static interface WebContainerServlet.MultipartRequestWrapper
          An interface implemented by a supporting object that will handle multipart/form-data encoded HTTP requests.
 
Field Summary
static boolean DEBUG_PRINT_MESSAGES_TO_CONSOLE
          Flag indicating whether client/server messages should be dumped to console.
static boolean DISABLE_CACHING
          A flag indicating whether caching should be disabled for all services.
static boolean ENABLE_CLIENT_DEBUG_CONSOLE
          Flag indicating whether client-side debug console should be enabled.
static java.lang.String SERVICE_ID_BLANK_DOCUMENT
          Service identifier of the blank document service.
static java.lang.String SERVICE_ID_DEFAULT
          Service identifier of the 'default' service.
static java.lang.String SERVICE_ID_NEW_INSTANCE
          Service identifier of the 'new instance' service.
static java.lang.String SERVICE_ID_PARAMETER
          Request parameter identifying requested Service.
static java.lang.String SERVICE_ID_SESSION_EXPIRED
          Service identifier of the 'session expired' service.
 
Constructor Summary
WebContainerServlet()
          Default constructor.
 
Method Summary
protected  void addInitScript(Service service)
          Adds a JavaScript service to be loaded at initialization.
protected  void addInitStyleSheet(Service service)
          Adds a CSS style sheet to be loaded at initialization.
protected  void addStartupScript(Service service)
          Deprecated. will be removed
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles a GET request.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles a POST request.
static Connection getActiveConnection()
          Returns a reference to the Connection that is relevant to the current thread, or null if no connection is relevant.
 java.util.Iterator getInitScripts()
          Returns an iterator over initialization script services.
 java.util.Iterator getInitStyleSheets()
          Returns an iterator over initialization script services.
static WebContainerServlet.MultipartRequestWrapper getMultipartRequestWrapper()
          Returns the multipart/form-data encoded HTTP request handler.
static ResourceRegistry getResourceRegistry()
          Retrieves the global ResourceRegistry.
static ServiceRegistry getServiceRegistry()
          Retrieves the global ServiceRegistry.
abstract  nextapp.echo.app.ApplicationInstance newApplicationInstance()
          Creates a new ApplicationInstance for visitor to an application.
protected  void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Processes a HTTP request and generates a response.
static void setMultipartRequestWrapper(WebContainerServlet.MultipartRequestWrapper multipartRequestWrapper)
          Sets the multipart/form-data encoded HTTP request handler.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_PRINT_MESSAGES_TO_CONSOLE

public static final boolean DEBUG_PRINT_MESSAGES_TO_CONSOLE
Flag indicating whether client/server messages should be dumped to console.


DISABLE_CACHING

public static final boolean DISABLE_CACHING
A flag indicating whether caching should be disabled for all services. This flag is for testing purposes only, and should be disabled for production use.

See Also:
Constant Field Values

ENABLE_CLIENT_DEBUG_CONSOLE

public static final boolean ENABLE_CLIENT_DEBUG_CONSOLE
Flag indicating whether client-side debug console should be enabled.

See Also:
Constant Field Values

SERVICE_ID_PARAMETER

public static final java.lang.String SERVICE_ID_PARAMETER
Request parameter identifying requested Service.

See Also:
Constant Field Values

SERVICE_ID_DEFAULT

public static final java.lang.String SERVICE_ID_DEFAULT
Service identifier of the 'default' service. The 'default' service is rendered when a client makes a request without a service identifier and a session DOES exist.

See Also:
Constant Field Values

SERVICE_ID_BLANK_DOCUMENT

public static final java.lang.String SERVICE_ID_BLANK_DOCUMENT
Service identifier of the blank document service.

See Also:
Constant Field Values

SERVICE_ID_NEW_INSTANCE

public static final java.lang.String SERVICE_ID_NEW_INSTANCE
Service identifier of the 'new instance' service. The 'new instance' service is rendered when a client makes a request without a service identifier and a session DOES NOT exist..

See Also:
Constant Field Values

SERVICE_ID_SESSION_EXPIRED

public static final java.lang.String SERVICE_ID_SESSION_EXPIRED
Service identifier of the 'session expired' service. The 'session expired' service is rendered when a client makes a request that has an identifier and is intended for an active session, but no session exists.

See Also:
Constant Field Values
Constructor Detail

WebContainerServlet

public WebContainerServlet()
Default constructor.

Method Detail

newApplicationInstance

public abstract nextapp.echo.app.ApplicationInstance newApplicationInstance()
Creates a new ApplicationInstance for visitor to an application.

Returns:
a new ApplicationInstance

getActiveConnection

public static final Connection getActiveConnection()
Returns a reference to the Connection that is relevant to the current thread, or null if no connection is relevant.

Returns:
the relevant Connection

getMultipartRequestWrapper

public static WebContainerServlet.MultipartRequestWrapper getMultipartRequestWrapper()
Returns the multipart/form-data encoded HTTP request handler.

Returns:
The multipart/form-data encoded HTTP request handler.
See Also:
setMultipartRequestWrapper(nextapp.echo.webcontainer.WebContainerServlet.MultipartRequestWrapper)

getResourceRegistry

public static ResourceRegistry getResourceRegistry()
Retrieves the global ResourceRegistry.

Returns:
the global ResourceRegistry

getServiceRegistry

public static ServiceRegistry getServiceRegistry()
Retrieves the global ServiceRegistry.

Returns:
The global ServiceRegistry.

setMultipartRequestWrapper

public static final void setMultipartRequestWrapper(WebContainerServlet.MultipartRequestWrapper multipartRequestWrapper)
Sets the multipart/form-data encoded HTTP request handler. The multipart request wrapper can only be set one time. It should be set in a static block of your Echo application. This method will disregard additional attempts to set the wrapper if the provided wrapper's class is identical to the existing one. If the wrapper is already set and the new wrapper object's class is different or the wrapper is null, an exception is thrown.

Parameters:
multipartRequestWrapper - The handler for multipart/form-data encoded HTTP requests.
Throws:
java.lang.IllegalStateException - if the application attempts to change a previously set multipart request handler.

addInitScript

protected void addInitScript(Service service)
Adds a JavaScript service to be loaded at initialization.

Parameters:
service - the service which will provide JavaScript content.

addInitStyleSheet

protected void addInitStyleSheet(Service service)
Adds a CSS style sheet to be loaded at initialization.

Parameters:
service - the service which will provide the CSS content.

addStartupScript

protected void addStartupScript(Service service)
Deprecated. will be removed

See Also:
addInitScript(nextapp.echo.webcontainer.Service)

doGet

public final void doGet(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
                 throws java.io.IOException,
                        javax.servlet.ServletException
Handles a GET request.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
java.io.IOException
javax.servlet.ServletException
See Also:
process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doPost

public final void doPost(javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response)
                  throws java.io.IOException,
                         javax.servlet.ServletException
Handles a POST request.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
java.io.IOException
javax.servlet.ServletException
See Also:
process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

getInitScripts

public java.util.Iterator getInitScripts()
Returns an iterator over initialization script services.

Returns:
the iterator

getInitStyleSheets

public java.util.Iterator getInitStyleSheets()
Returns an iterator over initialization script services.

Returns:
the iterator

process

protected void process(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws java.io.IOException,
                       javax.servlet.ServletException
Processes a HTTP request and generates a response.

Parameters:
request - the incoming HttpServletRequest
response - the outgoing HttpServletResponse
Throws:
java.io.IOException
javax.servlet.ServletException

NextApp Echo3
v3.0.b4