com.opensymphony.webwork.dispatcher
Class CoolUriServletDispatcher

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.opensymphony.webwork.dispatcher.ServletDispatcher
              extended bycom.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:

You can have as many parameters you'd like to use. Alternatively the URL can be shortened to the following:

This is the same as:

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

Field Summary
 
Fields inherited from class com.opensymphony.webwork.dispatcher.ServletDispatcher
encoding, locale, log
 
Fields inherited from interface com.opensymphony.webwork.WebWorkStatics
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERLVET_DISPATCHER, SERVLET_CONFIG, SERVLET_DISPATCHER
 
Constructor Summary
CoolUriServletDispatcher()
           
 
Method Summary
 void service(HttpServletRequest request, HttpServletResponse response)
          Parses the servlet path for the action name and parameters (see the class description for an explanation of the format).
 
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 javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoolUriServletDispatcher

public CoolUriServletDispatcher()
Method Detail

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.

WebWork Project Page