tomp.ext.servlet
Class AdvancedServletApplication

java.lang.Object
  |
  +--tomp.ext.Application
        |
        +--tomp.ext.servlet.ServletApplication
              |
              +--tomp.ext.servlet.AdvancedServletApplication

public class AdvancedServletApplication
extends ServletApplication

Class AdvancedServletApplication is an exntesion of the simple ServletApplication.
Calls actions when user is logged using a form-base login (form contains appropriately named input fields user and password and action == login.
The database of users (and admins) is implemented as simply as possible: loaded from Properties in file users.properties. if this file does not exist in the current directory or is not accessible, the user database remain empty and thus no user/admin can log in.


Field Summary
 
Fields inherited from class tomp.ext.servlet.ServletApplication
initAction, servlet
 
Fields inherited from class tomp.ext.Application
LOGFILE, NONE, STDERR
 
Constructor Summary
AdvancedServletApplication(javax.servlet.http.HttpServlet servlet)
          Constructor: Registers the "login" actions.
 
Method Summary
 void init()
          Load the user database from Properties file (user=password at each non-comment line).
protected  UserLoggedAction makeUserLoggedAction(java.lang.Class id, ServletAction previous, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String username)
          Makes an UserLoggedAction.
 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.servlet.ServletApplication
destroy, getServlet, makeInitAction, makeInitAction, makeRequestAction, makeRequestAction, makeStartSessionAction, makeStartSessionAction
 
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
 

Constructor Detail

AdvancedServletApplication

public AdvancedServletApplication(javax.servlet.http.HttpServlet servlet)
Constructor: Registers the "login" actions.

Method Detail

init

public void init()
          throws EXTException
Load the user database from Properties file (user=password at each non-comment line).
The file is named "users.properties" and placed in the current directory (i.e. usually the directory from that the web server is launched).

Overrides:
init in class ServletApplication
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:

Overrides:
service in class ServletApplication
javax.servlet.ServletException
java.io.IOException

makeUserLoggedAction

protected UserLoggedAction makeUserLoggedAction(java.lang.Class id,
                                                ServletAction previous,
                                                javax.servlet.http.HttpServletRequest req,
                                                javax.servlet.http.HttpServletResponse res,
                                                java.lang.String username)
                                         throws EXTException
Makes an UserLoggedAction.
There exist two of them: UserLoggedAction and AdminLoggedAction. Other may be defined by user and registered by an extended AdvancedServletApplication.

EXTException