NextApp Echo
App Container 1.1.4

nextapp.echoservlet
Class EchoServer

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bynextapp.echoservlet.EchoServer
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

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

Holds global information about an application and handles HTTP requests for an application. This class is extended by an application.

See Also:
Serialized Form

Nested Class Summary
static interface EchoServer.MultipartRequestWrapper
          An interface implemented by a supporting object that will handle multipart/form-data encoded HTTP requests.
 
Field Summary
static java.lang.String CHARACTER_ENCODING_ISO_8859_1
           
static java.lang.String CHARACTER_ENCODING_ISO_8859_2
           
static java.lang.String CHARACTER_ENCODING_ISO_8859_3
           
static java.lang.String CHARACTER_ENCODING_ISO_8859_4
           
static java.lang.String CHARACTER_ENCODING_ISO_8859_5
           
static java.lang.String CHARACTER_ENCODING_US_ASCII
           
static java.lang.String CHARACTER_ENCODING_UTF_8
           
static java.lang.String ID_STRING
          The app container name and version, as well as the framework name and version.
static Service SERVICE_BLANK_DOCUMENT
          A blank HTML page, suitable for filling empty ContainerPanes, etc.
static Service SERVICE_CLIENT_ERROR_SCRIPT
           
static Service SERVICE_COLLECTIONS_SCRIPT
          The JavaScript include which provides collections-framework-like functionality to JavaScript objects.
static Service SERVICE_INITIALIZER
          The service responsible for initializing applications
static Service SERVICE_SAFE_INVOKE_DEFAULT
          The default safe method invocation service
static Service SERVICE_SAFE_INVOKE_EXCEPTION_SUPPORT
          The safe method invocation service for browsers that support exception handling using try/catch/finally blocks.
static Service SERVICE_SESSION_EXPIRED
          The service a client browser will be directed to in the event that his/her session expires.
 
Constructor Summary
EchoServer()
           
 
Method Summary
static void addGlobalService(Service service)
          Adds a globally available service that will be available to all applications deployed with this EchoServer object.
 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.
 ApplicationProperties getApplicationProperties()
          Returns the Application Properties for this Echo Servlet.
 java.util.Locale getDefaultLocale(javax.servlet.http.HttpServletRequest request)
          Returns the default locale based on the request.
static EchoServer.MultipartRequestWrapper getMultipartRequestWrapper()
          Returns the multipart/form-data encoded HTTP request handler.
 java.lang.String getSessionExpirationUri(java.lang.String applicationUri)
          Returns the URI that should be redirected to in the event a user's session within an Echo application expires.
 void init(javax.servlet.ServletConfig config)
           
static void loadPeerBindings(java.lang.String propertiesFile)
          Loads peer bindings for additional components.
abstract  nextapp.echo.EchoInstance newInstance()
          A method to be provided by the derived class that will return a new EchoInstance (an instance of an Echo application).
protected  void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles an HTTP request to the EchoServer.
protected  void processException(InstancePeer instancePeer, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Exception ex)
          Processes an exception which occurred during an invocation of the process() method.
static void setMultipartRequestWrapper(EchoServer.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, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARACTER_ENCODING_ISO_8859_1

public static final java.lang.String CHARACTER_ENCODING_ISO_8859_1
See Also:
Constant Field Values

CHARACTER_ENCODING_ISO_8859_2

public static final java.lang.String CHARACTER_ENCODING_ISO_8859_2
See Also:
Constant Field Values

CHARACTER_ENCODING_ISO_8859_3

public static final java.lang.String CHARACTER_ENCODING_ISO_8859_3
See Also:
Constant Field Values

CHARACTER_ENCODING_ISO_8859_4

public static final java.lang.String CHARACTER_ENCODING_ISO_8859_4
See Also:
Constant Field Values

CHARACTER_ENCODING_ISO_8859_5

public static final java.lang.String CHARACTER_ENCODING_ISO_8859_5
See Also:
Constant Field Values

CHARACTER_ENCODING_US_ASCII

public static final java.lang.String CHARACTER_ENCODING_US_ASCII
See Also:
Constant Field Values

CHARACTER_ENCODING_UTF_8

public static final java.lang.String CHARACTER_ENCODING_UTF_8
See Also:
Constant Field Values

ID_STRING

public static final java.lang.String ID_STRING
The app container name and version, as well as the framework name and version. This information will be printed in META tags in all generated documents.

See Also:
Constant Field Values

SERVICE_INITIALIZER

public static final Service SERVICE_INITIALIZER
The service responsible for initializing applications


SERVICE_BLANK_DOCUMENT

public static final Service SERVICE_BLANK_DOCUMENT
A blank HTML page, suitable for filling empty ContainerPanes, etc.


SERVICE_COLLECTIONS_SCRIPT

public static final Service SERVICE_COLLECTIONS_SCRIPT
The JavaScript include which provides collections-framework-like functionality to JavaScript objects.


SERVICE_SESSION_EXPIRED

public static final Service SERVICE_SESSION_EXPIRED
The service a client browser will be directed to in the event that his/her session expires.


SERVICE_SAFE_INVOKE_DEFAULT

public static final Service SERVICE_SAFE_INVOKE_DEFAULT
The default safe method invocation service


SERVICE_SAFE_INVOKE_EXCEPTION_SUPPORT

public static final Service SERVICE_SAFE_INVOKE_EXCEPTION_SUPPORT
The safe method invocation service for browsers that support exception handling using try/catch/finally blocks.


SERVICE_CLIENT_ERROR_SCRIPT

public static final Service SERVICE_CLIENT_ERROR_SCRIPT
Constructor Detail

EchoServer

public EchoServer()
Method Detail

addGlobalService

public static void addGlobalService(Service service)
Adds a globally available service that will be available to all applications deployed with this EchoServer object. Global services may not be removed.

Parameters:
service - The global service to be added.

getMultipartRequestWrapper

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

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

loadPeerBindings

public static final void loadPeerBindings(java.lang.String propertiesFile)
Loads peer bindings for additional components. This method is used to associate custom component peers with custom components.

Parameters:
propertiesFile - The name of the properties file containing the peer binding data.

setMultipartRequestWrapper

public static final void setMultipartRequestWrapper(EchoServer.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.

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.

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.

Throws:
java.io.IOException
javax.servlet.ServletException
See Also:
process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

getApplicationProperties

public final ApplicationProperties getApplicationProperties()
Returns the Application Properties for this Echo Servlet.

Returns:
The Application Properties for this Echo Servlet.

getDefaultLocale

public java.util.Locale getDefaultLocale(javax.servlet.http.HttpServletRequest request)
Returns the default locale based on the request.


getSessionExpirationUri

public java.lang.String getSessionExpirationUri(java.lang.String applicationUri)
Returns the URI that should be redirected to in the event a user's session within an Echo application expires. The application's URI is provided. The default implementation simply returns the application's URI, restarting the app. This method should be overridden by applications that desire to direct users to an alternate URI.

Parameters:
applicationUri - The URI of the Echo application.
Returns:
The URI to redirect to in the event the user's session expires.

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException
See Also:
Servlet.init(javax.servlet.ServletConfig)

newInstance

public abstract nextapp.echo.EchoInstance newInstance()
A method to be provided by the derived class that will return a new EchoInstance (an instance of an Echo application).

Returns:
A new EchoInstance for the new user.

process

protected void process(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws java.io.IOException,
                       javax.servlet.ServletException
Handles an HTTP request to the EchoServer. This method will create a Connection to wrap the request and response objects provided by the servlet container and invoke Connection's process() method to handle it. If the request is encoded as multipart/form-data, the MultipartRequestWrapper will be used.

Parameters:
request - The HTTPServletRequest object provided by the servlet container.
response - The HTTPServletResponse object provided by the servlet container.
Throws:
java.io.IOException
javax.servlet.ServletException

processException

protected void processException(InstancePeer instancePeer,
                                javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response,
                                java.lang.Exception ex)
                         throws java.io.IOException,
                                javax.servlet.ServletException
Processes an exception which occurred during an invocation of the process() method. This method may be overriden to take additional actions when errors occur.

Parameters:
instancePeer - The InstancePeer object of the failed application.
request - The HttpServletRequest in use during failure.
response - The HttpServletResponse in use during failure.
ex - The Exception that occurred.
Throws:
java.io.IOException
javax.servlet.ServletException

NextApp Echo
App Container 1.1.4