org.apache.agila.impl.servlet
Class VelocityActionServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.agila.impl.servlet.ActionServlet
              extended by org.apache.agila.impl.servlet.VelocityActionServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
AgilaServlet

public abstract class VelocityActionServlet
extends ActionServlet

Standard riff ont he actionservlet idea

Author:
Geir Magnusson Jr.
See Also:
Serialized Form

Nested Class Summary
 class VelocityActionServlet.ServletAppContext
          little wrapper class to safely pass the ServletContext to the loader
 
Field Summary
static java.lang.String DEFAULT_PROPS
           
static java.lang.String HTTP_ACTION_VERB
           
static java.lang.String SERVLET_KEY
           
static java.lang.String TEMPLATE_PATH_KEY
           
 
Constructor Summary
VelocityActionServlet()
           
 
Method Summary
 void debug(java.lang.String msg)
          debug messages
 void debug(java.lang.String msg, java.lang.Throwable e)
           
 void defaultAction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Implement this to make our parent happy
abstract  void defaultAction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, org.apache.velocity.VelocityContext ctx)
          Abstract method to be implemented by children, called when there is no action specified
 void error(java.lang.String msg)
          error message
 void error(java.lang.String msg, java.lang.Throwable e)
           
protected  void errorPage(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
           
 void fatal(java.lang.String msg)
          fatal message
 void fatal(java.lang.String msg, java.lang.Throwable e)
           
protected  java.lang.String getActionVerb()
           
protected  java.lang.String getInitParameter(java.lang.String key, java.lang.String defaultValue)
           
protected  java.lang.String getTemplatePathPrefix()
           
abstract  java.lang.String getTemplateRoot()
          Return the root of template path.
protected  org.apache.velocity.VelocityContext getVelocityContext(javax.servlet.http.HttpServletRequest req)
           
protected  org.apache.velocity.app.VelocityEngine getVelocityEngine()
           
 void info(java.lang.String msg)
           
 void info(java.lang.String msg, java.lang.Throwable e)
           
 void init()
           
protected  boolean renderTemplate(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String template)
           
protected  boolean renderTemplate(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, org.apache.velocity.VelocityContext vc, java.lang.String template)
           
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Service routine to dispatch via action verb.
 void trace(java.lang.String msg)
          trace messages
 void trace(java.lang.String msg, java.lang.Throwable e)
           
 void unknownAction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Implement this to make our parent happy
abstract  void unknownAction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, org.apache.velocity.VelocityContext ctx)
          Abstract method to be implemented by children, calle when the action specified is not found
 void warn(java.lang.String msg)
          warning message
 void warn(java.lang.String msg, java.lang.Throwable e)
           
 
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

TEMPLATE_PATH_KEY

public static final java.lang.String TEMPLATE_PATH_KEY
See Also:
Constant Field Values

SERVLET_KEY

public static final java.lang.String SERVLET_KEY
See Also:
Constant Field Values

DEFAULT_PROPS

public static final java.lang.String DEFAULT_PROPS
See Also:
Constant Field Values

HTTP_ACTION_VERB

public static final java.lang.String HTTP_ACTION_VERB
See Also:
Constant Field Values
Constructor Detail

VelocityActionServlet

public VelocityActionServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

getTemplateRoot

public abstract java.lang.String getTemplateRoot()
Return the root of template path. Note that this should not include the bit returned by getTemplatePathPrefix().


service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
             throws javax.servlet.ServletException,
                    java.io.IOException
Service routine to dispatch via action verb.

Overrides:
service in class ActionServlet
Parameters:
req -
res -
Throws:
javax.servlet.ServletException
java.io.IOException

defaultAction

public abstract void defaultAction(javax.servlet.http.HttpServletRequest req,
                                   javax.servlet.http.HttpServletResponse res,
                                   org.apache.velocity.VelocityContext ctx)
                            throws javax.servlet.ServletException,
                                   java.io.IOException
Abstract method to be implemented by children, called when there is no action specified

Parameters:
req -
res -
Throws:
javax.servlet.ServletException
java.io.IOException

unknownAction

public abstract void unknownAction(javax.servlet.http.HttpServletRequest req,
                                   javax.servlet.http.HttpServletResponse res,
                                   org.apache.velocity.VelocityContext ctx)
                            throws javax.servlet.ServletException,
                                   java.io.IOException
Abstract method to be implemented by children, calle when the action specified is not found

Parameters:
req -
res -
Throws:
javax.servlet.ServletException
java.io.IOException

defaultAction

public final void defaultAction(javax.servlet.http.HttpServletRequest req,
                                javax.servlet.http.HttpServletResponse res)
                         throws javax.servlet.ServletException
Implement this to make our parent happy

Specified by:
defaultAction in class ActionServlet
Parameters:
req -
res -
Throws:
javax.servlet.ServletException

unknownAction

public final void unknownAction(javax.servlet.http.HttpServletRequest req,
                                javax.servlet.http.HttpServletResponse res)
                         throws javax.servlet.ServletException
Implement this to make our parent happy

Specified by:
unknownAction in class ActionServlet
Parameters:
req -
res -
Throws:
javax.servlet.ServletException

getActionVerb

protected java.lang.String getActionVerb()
Specified by:
getActionVerb in class ActionServlet

getVelocityEngine

protected org.apache.velocity.app.VelocityEngine getVelocityEngine()

getInitParameter

protected java.lang.String getInitParameter(java.lang.String key,
                                            java.lang.String defaultValue)

info

public void info(java.lang.String msg)

info

public void info(java.lang.String msg,
                 java.lang.Throwable e)

warn

public void warn(java.lang.String msg)
warning message


warn

public void warn(java.lang.String msg,
                 java.lang.Throwable e)

error

public void error(java.lang.String msg)
error message


error

public void error(java.lang.String msg,
                  java.lang.Throwable e)

fatal

public void fatal(java.lang.String msg)
fatal message


fatal

public void fatal(java.lang.String msg,
                  java.lang.Throwable e)

debug

public void debug(java.lang.String msg)
debug messages


debug

public void debug(java.lang.String msg,
                  java.lang.Throwable e)

trace

public void trace(java.lang.String msg)
trace messages


trace

public void trace(java.lang.String msg,
                  java.lang.Throwable e)

getVelocityContext

protected org.apache.velocity.VelocityContext getVelocityContext(javax.servlet.http.HttpServletRequest req)

errorPage

protected void errorPage(javax.servlet.http.HttpServletRequest req,
                         javax.servlet.http.HttpServletResponse res)
                  throws javax.servlet.ServletException,
                         java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

getTemplatePathPrefix

protected java.lang.String getTemplatePathPrefix()

renderTemplate

protected boolean renderTemplate(javax.servlet.http.HttpServletRequest req,
                                 javax.servlet.http.HttpServletResponse res,
                                 java.lang.String template)

renderTemplate

protected boolean renderTemplate(javax.servlet.http.HttpServletRequest req,
                                 javax.servlet.http.HttpServletResponse res,
                                 org.apache.velocity.VelocityContext vc,
                                 java.lang.String template)


Copyright © 2004-2005 The Apache Software Foundation. All Rights Reserved.