com.taursys.servlet
Class ServletApp

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.taursys.servlet.ServletApp
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ServletApp
extends javax.servlet.http.HttpServlet

ServletApp functions as a main servlet which dispatches requests to registered ServletForms. This ServletApp uses a ServletFormFactory to create, recycle, pool and parse url's for ServletForms.

You should override the init method to register the virtual path's and ServletForms' package names for your application. You should also set the ServletFormFactory's defaultClassLoader if mapperxml.jar is in a common path rather than part of your application distribution.

The ServletApp routes all doPost requests to the doGet methdod.

Below is an example of typical implementation:

 public class MyMainServlet extends ServletApp {

   public void init(ServletConfig config) throws ServletException {
     super.init(config);
     getFactory().addPackage("/","com.taursys.examples.simpleweb");
     getFactory().setDefaultFormName("com.taursys.examples.simpleweb.ShowHidePage");
     getFactory().setDefaultClassLoader(getClass().getClassLoader());
     // Set default logging
     Debug.setLoggerAdapter(new SimpleLogger(Debug.DEBUG));
   }
 }
 

See Also:
Serialized Form

Constructor Summary
ServletApp()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Processes the HTTP Get request by dispatching it to a ServletForm.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process the HTTP Post request by invoking the doGet method.
 ServletFormFactory getFactory()
          Gets the ServletFormFactory for this ServletApp.
 void setFactory(ServletFormFactory factory)
          Sets the ServletFormFactory for this ServletApp.
 
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, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletApp

public ServletApp()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Processes the HTTP Get request by dispatching it to a ServletForm. The specific ServletForm is determined by the requested url. This ServletApp uses a ServletFormFactory to parse the url and return the appropriate ServletForm to service the request. The request is simply passed to the ServletForm. After the request is complete, the ServletForm is passed back to the ServletFormFactory for recycling (if supported). You can override this method to make additional application resources available by using the request.setAttribute method.

Throws:
javax.servlet.ServletException
java.io.IOException

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Process the HTTP Post request by invoking the doGet method.

Throws:
javax.servlet.ServletException
java.io.IOException

getFactory

public ServletFormFactory getFactory()
Gets the ServletFormFactory for this ServletApp.

Returns:
ServletFormFactory for this ServletApp

setFactory

public void setFactory(ServletFormFactory factory)
Sets the ServletFormFactory for this ServletApp.

Parameters:
factory - to use for this ServletApp


Copyright © 2007 Martin T Phelan. All Rights Reserved.