eu.webtoolkit.jwt
Class WtServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by eu.webtoolkit.jwt.WtServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

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

The abstract JWt servlet class.

This servlet processes all requests for a JWt application. You need to specialize this class to provide an entry point for your web application.

For each new session createApplication(WEnvironment) is called to create a new WApplication object for that session. The web controller that is implemented by this servlet validates each incoming request, and takes the appropriate action by either notifying the application of an event, or serving a WResource.

See Also:
Serialized Form

Constructor Summary
WtServlet()
          Constructor.
 
Method Summary
abstract  WApplication createApplication(WEnvironment env)
          Creates a new application for a new session.
protected  void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Implement the GET request.
protected  void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Implement the POST request.
 Configuration getConfiguration()
          Returns the JWt configuration.
static ServletApi getServletApi()
          This function is only to be used by JWt internals.
 void init(javax.servlet.ServletConfig config)
          Initiate the internal servlet api.
static boolean isAsyncSupported()
          Returns whether asynchronous processing is supported, which is only the case when the servlet container implements the Servlet 3.0 API, and when this application is configured to support asynchronous processing.
 boolean limitPlainHtmlSessions()
           
 java.lang.String readConfigurationProperty(java.lang.String name, java.lang.String value)
           
 void setConfiguration(Configuration configuration)
          Sets the JWt configuration.
 
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
 

Constructor Detail

WtServlet

public WtServlet()
Constructor.

Instantiates the servlet using the default configuration.

See Also:
getConfiguration()
Method Detail

getServletApi

public static ServletApi getServletApi()
This function is only to be used by JWt internals.

Returns:
the servlet API interface

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initiate the internal servlet api. If you want to override this function, make sure to call the super function, to ensure the initialization of the servlet api.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

doGet

protected void doGet(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              throws javax.servlet.ServletException,
                     java.io.IOException
Implement the GET request.

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

doPost

protected void doPost(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse resp)
               throws javax.servlet.ServletException,
                      java.io.IOException
Implement the POST request.

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

getConfiguration

public Configuration getConfiguration()
Returns the JWt configuration.

The Configuration is only definitively constructed after WtServlet#init() is invoked. You should only modify the configuration from this method.

Returns:
the configuration.

setConfiguration

public void setConfiguration(Configuration configuration)
Sets the JWt configuration.

You should only set the configuration from the servlet constructor.

Parameters:
configuration -

createApplication

public abstract WApplication createApplication(WEnvironment env)
Creates a new application for a new session.

Parameters:
env - the environment that describes the new user (agent) and initial parameters
Returns:
a new application object.

isAsyncSupported

public static boolean isAsyncSupported()
Returns whether asynchronous processing is supported, which is only the case when the servlet container implements the Servlet 3.0 API, and when this application is configured to support asynchronous processing. Asynchronous processing is required for both server push and the recursive event loop.

Returns:
whether asynchronous processing is supported

limitPlainHtmlSessions

public boolean limitPlainHtmlSessions()

readConfigurationProperty

public java.lang.String readConfigurationProperty(java.lang.String name,
                                                  java.lang.String value)