| java.lang.Object de.danet.an.util.web.action.WebActionHandler
All known Subclasses: util.MyActs,
WebActionHandler | public class WebActionHandler (Code) | | WebActionHandler is the base class for web action
request handlers. A derived class creates one or more instances of
itself (and thus WebActionHandler ) by calling the
constructor with the name of its method that is to be made
invokable as an argument.
|
Constructor Summary | |
protected | WebActionHandler(String methodName) Used by derived classes to construct web action handlers. | protected | WebActionHandler(String methodName, String actionName) An alternative constructor that may be used to assign an action
name (used in the HTTP request) that differs from the method
name. |
Method Summary | |
void | addToMap(Map map, boolean verifyDuplicates) Adds this WebActionHandler to a map that
associates action names with WebActionHandler s. | void | handleRequest(HttpServletRequest request) Handles the given request. |
WebActionHandler | protected WebActionHandler(String methodName)(Code) | | Used by derived classes to construct web action handlers. Web
action handlers thus constructed are assembled into collections
by a static method WebActionDispatcher suite() that
must be supplied by every class derived from
WebActionHandler . A derived class thus looks like:
public class MyActs extends WebActionHandler {
public MyActs(String method) {
super(method);
}
public static WebActionDispatcher suite() {
WebActionDispatcher suite = new WebActionDispatcher();
suite.addHandler(new MyActs("addSomething"));
}
public void addSomething(String arg1, String arg2) {
// This function may be invoked with a request
// ...?WAA=addSomething&WAP1=arg1&WAP2=arg2
}
}
The method that handles the action may have parameters
of type
java.lang.String String only - with
one exception. The first parameter may optionally be a
javax.servlet.http.HttpServletRequest . If the first
paramter is of that type, the request object is passed to the method
in addition to the specific WAPn parameter values.
Parameters: methodName - the name of the class' method to be invoked.The method name has to be unique, the return value of the method hasto be of type void and the parameters have to fulfill the requirementsstated above. Otherwise an IllegalArgumentException is thrown. |
WebActionHandler | protected WebActionHandler(String methodName, String actionName)(Code) | | An alternative constructor that may be used to assign an action
name (used in the HTTP request) that differs from the method
name.
Parameters: methodName - the name of the class' method to be invoked. Parameters: actionName - the name to be used as parameter WAA in the HTTP request. |
addToMap | void addToMap(Map map, boolean verifyDuplicates)(Code) | | Adds this WebActionHandler to a map that
associates action names with WebActionHandler s.
Parameters: map - the map this handler is to be inserted to. Parameters: verifyDuplicates - flag, indicating if it should be verified thatcurrently no other action handler is registered with this action name.In case of an duplicate entry, an IllegalStateException is thrown. |
|
|