PageMixer API - 3.1

jp.ne.dti.lares.foozy.pagemixer.servlet
Class ForwardCondition

java.lang.Object
  |
  +--jp.ne.dti.lares.foozy.pagemixer.servlet.ForwardCondition

public abstract class ForwardCondition
extends java.lang.Object

Abstraction of servlet control forwarding.

This encapsulates:

forwading condition:
for example, you may want to forward control from 'member only pages' to 'login form page' when user does not log in yet, but implemenation of 'login' is application specific.
forwarding destination:
for example, servlet/JSP path mapping is application specific.

Since:
PageMixer 3.0
See Also:
ForwardStrategy

Constructor Summary
ForwardCondition()
          Constructor.
 
Method Summary
 void cleanup(javax.servlet.http.HttpServlet servlet)
          Finalize.
abstract  java.lang.String forwards(ConsumerContext context)
          Decide destination to forward servlet control.
 void setup(javax.servlet.http.HttpServlet servlet)
          Initialize.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForwardCondition

public ForwardCondition()
Constructor.
Method Detail

setup

public void setup(javax.servlet.http.HttpServlet servlet)
           throws javax.servlet.ServletException
Initialize.

This method provides chance of specific initialization. For example:

  • get servlet init-param
  • get web application(= context) init-param
  • allocate specific resource(e.g.: JDBC Connection, new thread)
  • and so on

This is invoked from ForwardStrategy.setup(HttpServlet).

This implementation does nothing

Parameters:
servlet - with which this object works
Throws:
javax.servlet.ServletException - if initialization fails
See Also:
cleanup(HttpServlet)

cleanup

public void cleanup(javax.servlet.http.HttpServlet servlet)
Finalize.

You should release all resources which you allocate in setup(HttpServlet) in this method.

This is invoked from ForwardStrategy.cleanup(HttpServlet).

This implementation does nothing

Parameters:
servlet - with which this object works

forwards

public abstract java.lang.String forwards(ConsumerContext context)
Decide destination to forward servlet control.

This method has to:

decide whether control should be forwarded or not:
if control should not be forwarded, this method should return 'null'.
decide destination where control should be forward:
invoker uses returned value as the parameter to invoke ServletContext#getRequestDispatcher(), and forwards control.
Parameters:
context - of request
Returns:
destination if servlet control is forwarded, null otherwise

PageMixer API - 3.1