com.itmill.toolkit.terminal.web
Class ApplicationServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.itmill.toolkit.terminal.web.ApplicationServlet
All Implemented Interfaces:
Application.WindowAttachListener, Application.WindowDetachListener, Paintable.RepaintRequestListener, Serializable, Servlet, ServletConfig

public class ApplicationServlet
extends HttpServlet
implements Application.WindowAttachListener, Application.WindowDetachListener, Paintable.RepaintRequestListener

This servlet connects IT Mill Toolkit Application to Web. This servlet replaces both WebAdapterServlet and AjaxAdapterServlet.

Since:
4.0
Version:
4.1.4
Author:
IT Mill Ltd.
See Also:
Serialized Form

Nested Class Summary
 class ApplicationServlet.ParameterHandlerErrorImpl
          Implementation of ParameterHandler.ErrorEvent interface.
 class ApplicationServlet.URIHandlerErrorImpl
          Implementation of URIHandler.ErrorEvent interface.
 
Field Summary
protected static String DEFAULT_THEME
           
protected static String SESSION_ATTR_APPS
           
static String VERSION
          Version number of this release.
static String VERSION_BUILD
          Builds number.
static int VERSION_MAJOR
          Major version number.
static int VERSION_MINOR
          Minor version number.
 
Constructor Summary
ApplicationServlet()
           
 
Method Summary
protected  void addDirtyWindow(Application application, Window window)
           
protected  Map getDirtyWindows(Application app)
          Gets the list of dirty windows in application.
 String getResourceLocation(String theme, ThemeResource resource)
          Gets relative location of a theme resource.
protected static String getResourcePath(ServletContext servletContext, String path)
          Gets resource path using different implementations.
 ThemeSource getThemeSource()
          Returns the theme source.
 void init(ServletConfig servletConfig)
          Called by the servlet container to indicate to a servlet that the servlet is being placed into service.
 boolean isDebugMode(Map parameters)
          Checks if web adapter is in debug mode.
protected  void removeDirtyWindow(Application application, Window window)
           
 void repaintRequested(Paintable.RepaintRequestEvent event)
          Receives repaint request events.
protected  void service(HttpServletRequest request, HttpServletResponse response)
          Receives standard HTTP requests from the public service method and dispatches them.
 void windowAttached(Application.WindowAttachEvent event)
          Window attached
 void windowDetached(Application.WindowDetachEvent event)
          Window detached.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, 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

VERSION

public static final String VERSION
Version number of this release. For example "4.0.0".


VERSION_MAJOR

public static final int VERSION_MAJOR
Major version number. For example 4 in 4.1.0.


VERSION_MINOR

public static final int VERSION_MINOR
Minor version number. For example 1 in 4.1.0.


VERSION_BUILD

public static final String VERSION_BUILD
Builds number. For example 0-beta1 in 4.0.0-beta1.


SESSION_ATTR_APPS

protected static final String SESSION_ATTR_APPS
See Also:
Constant Field Values

DEFAULT_THEME

protected static final String DEFAULT_THEME
See Also:
Constant Field Values
Constructor Detail

ApplicationServlet

public ApplicationServlet()
Method Detail

init

public void init(ServletConfig servletConfig)
          throws ServletException
Called by the servlet container to indicate to a servlet that the servlet is being placed into service.

Specified by:
init in interface Servlet
Overrides:
init in class GenericServlet
Parameters:
servletConfig - the object containing the servlet's configuration and initialization parameters
Throws:
ServletException - if an exception has occurred that interferes with the servlet's normal operation.

service

protected void service(HttpServletRequest request,
                       HttpServletResponse response)
                throws ServletException,
                       IOException
Receives standard HTTP requests from the public service method and dispatches them.

Overrides:
service in class HttpServlet
Parameters:
request - the object that contains the request the client made of the servlet.
response - the object that contains the response the servlet returns to the client.
Throws:
ServletException - if an input or output error occurs while the servlet is handling the TRACE request.
IOException - if the request for the TRACE cannot be handled.

getResourceLocation

public String getResourceLocation(String theme,
                                  ThemeResource resource)
Gets relative location of a theme resource.

Parameters:
theme - the Theme name.
resource - the Theme resource.
Returns:
External URI specifying the resource

isDebugMode

public boolean isDebugMode(Map parameters)
Checks if web adapter is in debug mode. Extra output is generated to log when debug mode is enabled.

Parameters:
parameters -
Returns:
true if the web adapter is in debug mode. otherwise false.

getThemeSource

public ThemeSource getThemeSource()
Returns the theme source.

Returns:
ThemeSource

addDirtyWindow

protected void addDirtyWindow(Application application,
                              Window window)
Parameters:
application -
window -

removeDirtyWindow

protected void removeDirtyWindow(Application application,
                                 Window window)
Parameters:
application -
window -

windowAttached

public void windowAttached(Application.WindowAttachEvent event)
Description copied from interface: Application.WindowAttachListener
Window attached

Specified by:
windowAttached in interface Application.WindowAttachListener
Parameters:
event - the window attach event.
See Also:
Application.WindowAttachListener.windowAttached(Application.WindowAttachEvent)

windowDetached

public void windowDetached(Application.WindowDetachEvent event)
Description copied from interface: Application.WindowDetachListener
Window detached.

Specified by:
windowDetached in interface Application.WindowDetachListener
Parameters:
event - the window detach event.
See Also:
Application.WindowDetachListener.windowDetached(Application.WindowDetachEvent)

repaintRequested

public void repaintRequested(Paintable.RepaintRequestEvent event)
Receives repaint request events.

Specified by:
repaintRequested in interface Paintable.RepaintRequestListener
Parameters:
event - the repaint request event specifying the paintable source.
See Also:
Paintable.RepaintRequestListener.repaintRequested(Paintable.RepaintRequestEvent)

getDirtyWindows

protected Map getDirtyWindows(Application app)
Gets the list of dirty windows in application.

Parameters:
app -
Returns:

getResourcePath

protected static String getResourcePath(ServletContext servletContext,
                                        String path)
Gets resource path using different implementations. Required fo supporting different servlet container implementations (application servers).

Parameters:
servletContext -
path - the resource path.
Returns:
the resource path.


Copyright © 2000-2008 IT Mill Ltd. All Rights Reserved.