com.opensymphony.webwork.dispatcher
Class CoolUriServletDispatcher
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.opensymphony.webwork.dispatcher.ServletDispatcher
com.opensymphony.webwork.dispatcher.CoolUriServletDispatcher
- All Implemented Interfaces:
- Serializable, Servlet, ServletConfig, WebWorkStatics
- public class CoolUriServletDispatcher
- extends ServletDispatcher
A custom servlet dispatcher that maps servlet paths to actions. The format is the following:
http://HOST/ACTION_NAME/PARAM_NAME1/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
You can have as many parameters you'd like to use. Alternatively the URL can be shortened to the following:
http://HOST/ACTION_NAME/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
This is the same as:
http://HOST/ACTION_NAME/ACTION_NAME/PARAM_VALUE1/PARAM_NAME2/PARAM_VALUE2
Suppose for example we would like to display some articles by id at using the following URL sheme:
All we would have to do is to map the /article/* to this servlet and declare in WebWork an
action named article. This action would set its article parameter ID.
- Author:
- Cameron Braid, Jerome Bernard
- See Also:
- Serialized Form
Methods inherited from class com.opensymphony.webwork.dispatcher.ServletDispatcher |
createContextMap, getActionName, getActionName, getApplicationMap, getEncoding, getLocale, getMaxSize, getNameSpace, getNamespaceFromServletPath, getParameterMap, getRequestMap, getSaveDir, getSessionMap, init, isParamsWorkaroundEnabled, localeFromString, sendError, serviceAction, wrapRequest |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CoolUriServletDispatcher
public CoolUriServletDispatcher()
service
public void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException
- Parses the servlet path for the action name and parameters (see the class description for an
explanation of the format). Once parsed this method passes off control to the
ServletDispatcher.serviceAction(HttpServletRequest, HttpServletResponse, String, String, Map, Map, Map, Map)
method for action execution.
- Overrides:
service
in class ServletDispatcher
- Parameters:
request
- the http servlet request.response
- the http servlet response.
- Throws:
ServletException
- if an error occurs parsing the action name or parameters or if
an action occurs whene executing the action.