org.zkoss.zest.sys
Class ZestManager

java.lang.Object
  extended by org.zkoss.zest.sys.ZestManager

public class ZestManager
extends java.lang.Object

The core of ZEST that matches URL, instantiates actions, invokes actions and forwards to a view.

By default, the manager ignores a path if its extension does not match any of the allowed extensions. If you'd like more complex algorithm to decide which to ignore, you could override pathIgnored(java.lang.String, java.lang.String[]).

Author:
tomyeh

Constructor Summary
ZestManager()
          Constructor.
 
Method Summary
 boolean action(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles the action.
protected  void coerceParameters(ActionContext ac, java.lang.Object action)
          Coerces the request's parameters to action's corresponding fields.
 void destroy()
          Destroyes the manager.
static ZestManager getManager(javax.servlet.ServletContext ctx)
          Returns the manager associated with the context, or null if not initialized yet.
 javax.servlet.ServletContext getServletContext()
          Returns the servlet context that this manager is associated with
 void init(javax.servlet.ServletContext ctx, Parser parser)
          Initializes the manager.
 void loadConfiguration(Parser parser, java.lang.String configURI)
          Loads the configuration.
protected  boolean pathIgnored(java.lang.String path, java.lang.String extension, java.lang.String[] allowedExts)
          Returns whether the given path shall be ignored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZestManager

public ZestManager()
Constructor.

Method Detail

getManager

public static ZestManager getManager(javax.servlet.ServletContext ctx)
Returns the manager associated with the context, or null if not initialized yet.


init

public void init(javax.servlet.ServletContext ctx,
                 Parser parser)
Initializes the manager.

Parameters:
parser - the parser used to parse the configuration file (/WEB-INF/zest.xml)

destroy

public void destroy()
Destroyes the manager.


getServletContext

public javax.servlet.ServletContext getServletContext()
Returns the servlet context that this manager is associated with

Since:
1.1.0

loadConfiguration

public void loadConfiguration(Parser parser,
                              java.lang.String configURI)
Loads the configuration. This method is usually called automatically. However, you could invoke it if you'd like to reload the configuration (such as when you modify /WEB-INF/zest.xml)

Parameters:
configURI - the URI of the configuration file, such as (/WEB-INF/zest.xml).

action

public boolean action(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
               throws javax.servlet.ServletException,
                      java.io.IOException
Handles the action. It first identifies any action that matches the request, and then instantiates/invoke the matched action and forward to the view.

Returns:
whether it is mapped to an action (and then handled).
Throws:
javax.servlet.ServletException
java.io.IOException

coerceParameters

protected void coerceParameters(ActionContext ac,
                                java.lang.Object action)
                         throws java.lang.Throwable
Coerces the request's parameters to action's corresponding fields.

Throws:
java.lang.Throwable

pathIgnored

protected boolean pathIgnored(java.lang.String path,
                              java.lang.String extension,
                              java.lang.String[] allowedExts)
Returns whether the given path shall be ignored.

Default: the path is ignored if the extension does not match one of the given allowed extensions.

Parameters:
path - the given path to test
extension - the extension of the path (it is part of path). It is an empty string if there is no extension.
allowedExts - the allowed extension. If null or zero-length, it means all paths are allowed.
Since:
1.1.0


Copyright © 2005-2010 Potix Corporation. All Rights Reserved.