org.aris.actionservlet
Class ActionServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.aris.actionservlet.ActionServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class ActionServlet
extends javax.servlet.http.HttpServlet
implements java.io.Serializable

ActionServlet: Expanding Servlet and creating a framework using actions and XML.

comments:

1. Action classes are expected to be in package "Actions". (i.e. WEB-INF/classes/Actions)

2. The default class is named "Actions.Index". If the servlet is called without any parameters, Actions.Index will be executed.

3. The DATA directory is declared at the web.xml, and contains the TEMPLATES directory, where the xslt files are located.

Version:
1.0
Author:
Aris
See Also:
Serialized Form

Field Summary
 boolean debug
          Instructs the module to run in debugging mode.
 
Constructor Summary
ActionServlet()
           
 
Method Summary
 void destroy()
          Destroys the servlet.
 java.lang.String getActionPackage()
          Getter for property actionPackage.
 Config getConfig()
          Gets the config
static java.lang.String getDefAction()
           
 ActionEntityResolver getEntityResolver()
           
 ActionUriResolver getXslUriResolver()
           
 void hlError(java.io.PrintWriter writer, java.lang.Throwable e, java.lang.String reason)
          Send an error message to the browser if something goes wrong.
 void init(javax.servlet.ServletConfig config)
          Initializes the servlet.
 boolean isDebug()
          Getter for property debug.
 void reDir(java.lang.String URL, javax.servlet.http.HttpServletResponse response)
          Redirect the browser to a different url
 void setActionPackage(java.lang.String actionPackage)
          Setter for property actionPackage.
 void setDebug(boolean debug)
          Instructs the module to run in debugging mode.
static void setDefAction(java.lang.String defAction)
           
 void setEntityResolver(ActionEntityResolver entityResolver)
           
 void setXslUriResolver(ActionUriResolver xslUriResolver)
           
 void transformerParams(javax.xml.transform.Transformer transformer)
          This sets the default parameters for xsl tranformation: HOME,IMG,ACTION Override this to set additional global servlet parameters.
 
Methods inherited from class javax.servlet.http.HttpServlet
service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public boolean debug
Instructs the module to run in debugging mode. In this mode the XSLT's are not cached in order to be able to view all changes in the XSLT's immediatelly. When debug=false, the XSLT's are cached making the module run faster but any changes made are viewed only after restarting tomcat.

Constructor Detail

ActionServlet

public ActionServlet()
Method Detail

getConfig

public Config getConfig()
Gets the config

Returns:
Config

setDefAction

public static void setDefAction(java.lang.String defAction)
Parameters:
defAction - The defAction to set.

getDefAction

public static java.lang.String getDefAction()
Returns:
Returns the defAction.

getEntityResolver

public ActionEntityResolver getEntityResolver()
Returns:
Returns the entityResolver.

setEntityResolver

public void setEntityResolver(ActionEntityResolver entityResolver)
Parameters:
entityResolver - The entityResolver to set.

getXslUriResolver

public ActionUriResolver getXslUriResolver()
Returns:
Returns the xslUriResolver.

setXslUriResolver

public void setXslUriResolver(ActionUriResolver xslUriResolver)
Parameters:
xslUriResolver - The xslUriResolver to set.

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initializes the servlet.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Parameters:
config - The servlet config
Throws:
javax.servlet.ServletException - -

destroy

public void destroy()
Destroys the servlet.

Specified by:
destroy in interface javax.servlet.Servlet
Overrides:
destroy in class javax.servlet.GenericServlet

transformerParams

public void transformerParams(javax.xml.transform.Transformer transformer)
This sets the default parameters for xsl tranformation: HOME,IMG,ACTION Override this to set additional global servlet parameters.

Parameters:
transformer - the Transformer object

reDir

public void reDir(java.lang.String URL,
                  javax.servlet.http.HttpServletResponse response)
Redirect the browser to a different url

Parameters:
URL - The URL to redirect to.
response - Response parameter.

hlError

public void hlError(java.io.PrintWriter writer,
                    java.lang.Throwable e,
                    java.lang.String reason)
Send an error message to the browser if something goes wrong.

Parameters:
writer - A PrintWriter.
e - The exception thrown for this error.
reason - A reason that this error occured.

isDebug

public boolean isDebug()
Getter for property debug.

Returns:
Value of property debug.

setDebug

public void setDebug(boolean debug)
Instructs the module to run in debugging mode. In this mode the XSLT's are not cached in order to be able to view all changes in the XSLT's immediatelly. When debug=false, the XSLT's are cached making the module run faster but any changes made are viewed only after restarting tomcat.

Parameters:
debug - When debug=false, the XSLT's are cached making the module run faster but any changes made are viewed only after restarting tomcat. Set this to true during development and false during release builds.

getActionPackage

public java.lang.String getActionPackage()
Getter for property actionPackage.

Returns:
Value of property actionPackage.

setActionPackage

public void setActionPackage(java.lang.String actionPackage)
Setter for property actionPackage. Sets the package which contains the action classes. By default this is the "Actions" package.

Parameters:
actionPackage - New value of property actionPackage.