|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--org.apache.struts.action.Action
|
+--org.beyondcode.struts.dispatcher.MethodDispatcherAction
This class dispatches incoming requests to one of its member functions
according to the value of the method property of the
mapping supplied with the request.
This class is meant to be extended by custom classes, which provide
the member functions which are targets of request dispatches.
Member functions that requests can be dispatched to need to have
exactly the same signature (return type and arguments) as the
perform() method in org.apache.struts.action.Action.
Request dispatching to member functions is access controlled.
Dispatching occurs only when the request has access to the target
function (as determined by hasAccess()) -
otherwise the request is forwarded to the denied forward.
The hasAccess() method should be overriden in subclasses
to implement custom access control, based on information contained in
the request (such as cookies or the HttpSession) and the
mapping.
The mapping supplied with the request needs to implement
the org.beyondcode.struts.dispatcher.DispatcherMapping interface, to
provide access to the necessary properties.
| Field Summary | |
protected static org.apache.struts.util.MessageResources |
messages
Handle to properties file with error messages. |
protected java.util.HashMap |
methods
Handles to methods that have been recognized by introspection as possible targets for dispatches. |
| Fields inherited from class org.apache.struts.action.Action |
DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGES_KEY, MULTIPART_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY |
| Constructor Summary | |
protected |
MethodDispatcherAction()
Default constructor. |
| Method Summary | |
protected boolean |
hasAccess(DispatcherMapping mapping,
javax.servlet.http.HttpServletRequest request)
This method should be overridden in subclasses to implement custom access control to individual methods. |
org.apache.struts.action.ActionForward |
perform(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
When called by the ActionServlet, this method dispatches
incoming requests to one of the methods recognized in the constructor,
having the same signature as the perform() method. |
| Methods inherited from class org.apache.struts.action.Action |
generateToken, getLocale, getResources, getServlet, isCancelled, isTokenValid, perform, perform, perform, resetToken, saveErrors, saveToken, setLocale, setServlet, toHex |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static org.apache.struts.util.MessageResources messages
protected java.util.HashMap methods
| Constructor Detail |
protected MethodDispatcherAction()
perform()
method. When comparing types of arguments and returnType, subclasses
of the types used in the original perform() method are
not permitted.
| Method Detail |
public org.apache.struts.action.ActionForward perform(org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionForm form,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
ActionServlet, this method dispatches
incoming requests to one of the methods recognized in the constructor,
having the same signature as the perform() method.
The name of the method to dispatch to is the value of the
method property of the mapping argument,
which must implement the DispatcherMapping interface.
This method also performs access control. Dispatch to the method
named in the mapping only occurs if this class'
hasAccess() method returns true, otherwise the
value of mapping.denied() is returned from this method.
perform in class org.apache.struts.action.Actionmapping - Must implement DispatcherMappingform - request - response -
null on error.
java.io.IOException
javax.servlet.ServletException
protected boolean hasAccess(DispatcherMapping mapping,
javax.servlet.http.HttpServletRequest request)
true.
mapping - The mappingrequest - The request
true if this request has access to this action,
false otherwise. The default implementation always
returns true.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||