tomp.ext.servlet
Class ServletApplication

java.lang.Object
  |
  +--tomp.ext.Application
        |
        +--tomp.ext.servlet.ServletApplication
Direct Known Subclasses:
AdvancedServletApplication

public class ServletApplication
extends Application

Class ServletApplication is an extension of the simple Application.
Calls actions when the app. is initialized, when web user creates a new HttpSession, and also on normal HttpServletRequest event. Also, on servlet shutdown (Servlet.destroy() method) an action is created and launched (EndApplicationAction). User can call any previously registered action by specifying the name in the action request parameter.


Field Summary
protected  ServletAction initAction
           
protected  javax.servlet.http.HttpServlet servlet
           
 
Fields inherited from class tomp.ext.Application
LOGFILE, NONE, STDERR
 
Constructor Summary
ServletApplication(javax.servlet.http.HttpServlet servlet)
           Initializes the superclass (Application) object, i.e. all the standard settings regarding XML,...
 
Method Summary
 void destroy()
          Represents the HttpServlet.destroy() method that forwards the destroy() event to this method.
 javax.servlet.http.HttpServlet getServlet()
           
 void init()
          Creates the StartApplicationAction and runs it.
protected  StartApplicationAction makeInitAction(java.lang.Class id, ServletApplication app, javax.servlet.http.HttpServlet servlet)
          Creates a StartApplicationAction with specified params.
protected  StartApplicationAction makeInitAction(ServletApplication app, javax.servlet.http.HttpServlet servlet)
          Creates a StartApplicationAction with specified params.
protected  RequestAction makeRequestAction(java.lang.Class id, ServletAction previous, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Creates a RequestAction with specified params.
protected  RequestAction makeRequestAction(ServletAction previous, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Creates a RequestAction with specified params.
protected  StartSessionAction makeStartSessionAction(java.lang.Class id, ServletAction previous, javax.servlet.http.HttpSession session)
          Creates a StartSessionAction with specified params.
protected  StartSessionAction makeStartSessionAction(ServletAction previous, javax.servlet.http.HttpSession session)
          Creates a StartSessionAction with specified params.
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Actually perfoms the HttpServlet.service(req, res) method that is forwarded to this method by the extended EXTServlet.service(req, res)
The method creates and launches actions according to the: HttpSession bound to the request and request parameter action
 
Methods inherited from class tomp.ext.Application
allocateEXTName, allocateName, allocateName, allocateNCName, endInputDocument, getActionClass, getCodeForURI, getDefaultMySQLDriver, getDefaultOutputEncoding, getDefaultOutputMethod, getDocumentBuilderFactory, getEmptyAC, getNamePool, getTransformerFactory, id, makeAction, newBuilder, newDocument, newEmptyAC, newNSArrayForName, newTemplates, newTemplatesHandler, registerActionClass, startInputDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servlet

protected javax.servlet.http.HttpServlet servlet

initAction

protected ServletAction initAction
Constructor Detail

ServletApplication

public ServletApplication(javax.servlet.http.HttpServlet servlet)
  1. Initializes the superclass (Application) object, i.e. all the standard settings regarding XML,...
  2. Registers the web-app specific action classes (StartApplicationAction, EndApplicationAction, RequestAction, StartSessionAction).
  3. Registers the Namespace-qualified XML names used when building a XML tree for above mentioned servlet-specific actions.

Method Detail

getServlet

public javax.servlet.http.HttpServlet getServlet()
Returns:
HttpServlet object to whom this application belongs.

init

public void init()
          throws EXTException
Creates the StartApplicationAction and runs it.

EXTException

destroy

public void destroy()
             throws EXTException
Represents the HttpServlet.destroy() method that forwards the destroy() event to this method.
Simply creates and executes the EndApplicationAction (or that one been registered as EndApplicationAction).

EXTException

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
             throws javax.servlet.ServletException,
                    java.io.IOException
Actually perfoms the HttpServlet.service(req, res) method that is forwarded to this method by the extended EXTServlet.service(req, res)
The method creates and launches actions according to the:

javax.servlet.ServletException
java.io.IOException

makeRequestAction

protected RequestAction makeRequestAction(java.lang.Class id,
                                          ServletAction previous,
                                          javax.servlet.http.HttpServletRequest req,
                                          javax.servlet.http.HttpServletResponse res)
                                   throws EXTException
Creates a RequestAction with specified params.

Parameters:
id - the class object of the requested RequestAction class
previous - previous action
req - HttpServletRequest
res - HttpServletResponse
Returns:
the newly created RequestAction -- the actual type is got via getActionClass
EXTException
See Also:
Application.getActionClass(java.lang.Class)

makeRequestAction

protected RequestAction makeRequestAction(ServletAction previous,
                                          javax.servlet.http.HttpServletRequest req,
                                          javax.servlet.http.HttpServletResponse res)
                                   throws EXTException
Creates a RequestAction with specified params.
It has one parameter less than the full version of this create method, always creates class that has been registered under the exact RequestAction.class type.

Parameters:
previous - previous action
req - HttpServletRequest
res - HttpServletResponse
Returns:
the newly created RequestAction -- the actual type is got via getActionClass
EXTException
See Also:
Application.getActionClass(java.lang.Class)

makeStartSessionAction

protected StartSessionAction makeStartSessionAction(java.lang.Class id,
                                                    ServletAction previous,
                                                    javax.servlet.http.HttpSession session)
                                             throws EXTException
Creates a StartSessionAction with specified params.

Parameters:
id - the class object of the requested StartSessionAction class
previous - previous action
Returns:
the newly created StartSessionAction -- the actual type is got via getActionClass
EXTException
See Also:
Application.getActionClass(java.lang.Class)

makeStartSessionAction

protected StartSessionAction makeStartSessionAction(ServletAction previous,
                                                    javax.servlet.http.HttpSession session)
                                             throws EXTException
Creates a StartSessionAction with specified params.
It has one parameter less than the full version of this create method, always creates class that has been registered under the exact StartSessionAction.class type.

Parameters:
previous - previous action
Returns:
the newly created StartSessionAction -- the actual type is got via getActionClass
EXTException
See Also:
Application.getActionClass(java.lang.Class)

makeInitAction

protected StartApplicationAction makeInitAction(java.lang.Class id,
                                                ServletApplication app,
                                                javax.servlet.http.HttpServlet servlet)
                                         throws EXTException
Creates a StartApplicationAction with specified params.

Parameters:
id - the class object of the requested StartApplicationAction class
Returns:
the newly created StartApplicationAction -- the actual type is got via getActionClass
EXTException
See Also:
Application.getActionClass(java.lang.Class)

makeInitAction

protected StartApplicationAction makeInitAction(ServletApplication app,
                                                javax.servlet.http.HttpServlet servlet)
                                         throws EXTException
Creates a StartApplicationAction with specified params.
It has one parameter less than the full version of this create method, always creates class that has been registered under the exact StartApplicationAction.class type.

Returns:
the newly created StartApplicationAction -- the actual type is got via getActionClass
EXTException
See Also:
Application.getActionClass(java.lang.Class)