Index: /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/ServletPathMapper.java =================================================================== --- /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/ServletPathMapper.java (revision 157634) +++ /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/ServletPathMapper.java (working copy) @@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest; + import org.apache.commons.chain.Catalog; import org.apache.commons.chain.Command; import org.apache.commons.chain.Context; @@ -34,53 +35,19 @@ * @author Craig R. McClanahan */ -public class ServletPathMapper implements Command { +public class ServletPathMapper extends AbstractMapper implements Command { // ------------------------------------------------------ Instance Variables - private String catalogKey = ChainProcessor.CATALOG_DEFAULT; - - - // -------------------------------------------------------------- Properties - - /** - *
Return the context key under which our {@link Catalog} has been - * stored.
- */ - public String getCatalogKey() { - - return (this.catalogKey); - - } - - - /** - *Set the context key under which our {@link Catalog} has been - * stored.
- * - * @param catalogKey The new catalog key - */ - public void setCatalogKey(String catalogKey) { - - this.catalogKey = catalogKey; - - } - - - // --------------------------------------------------------- Command Methods - - - /** *Look up the servlet path information for this request, and use it to * select an appropriate {@link Command} to be executed. * * @param context Context for the current request */ - public boolean execute(Context context) throws Exception { - + protected String getCommandName(Context context) { // Look up the servlet path for this request ServletWebContext swcontext = (ServletWebContext) context; HttpServletRequest request = swcontext.getRequest(); @@ -89,13 +56,8 @@ if (servletPath == null) { servletPath = request.getServletPath(); } - - // Map to the Command specified by the extra path info - Catalog catalog = (Catalog) context.get(getCatalogKey()); - Command command = catalog.getCommand(servletPath); - return (command.execute(context)); - + + return servletPath; } - } Index: /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/PathInfoMapper.java =================================================================== --- /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/PathInfoMapper.java (revision 157634) +++ /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/PathInfoMapper.java (working copy) @@ -34,42 +34,9 @@ * @author Craig R. McClanahan */ -public class PathInfoMapper implements Command { +public class PathInfoMapper extends AbstractMapper implements Command { - // ------------------------------------------------------ Instance Variables - - - private String catalogKey = ChainProcessor.CATALOG_DEFAULT; - - - // -------------------------------------------------------------- Properties - - - /** - *
Return the context key under which our {@link Catalog} has been - * stored.
- */ - public String getCatalogKey() { - - return (this.catalogKey); - - } - - - /** - *Set the context key under which our {@link Catalog} has been - * stored.
- * - * @param catalogKey The new catalog key - */ - public void setCatalogKey(String catalogKey) { - - this.catalogKey = catalogKey; - - } - - // --------------------------------------------------------- Command Methods @@ -79,7 +46,7 @@ * * @param context Context for the current request */ - public boolean execute(Context context) throws Exception { + public String getCommandName(Context context) { // Look up the extra path information for this request ServletWebContext swcontext = (ServletWebContext) context; @@ -90,10 +57,7 @@ pathInfo = request.getPathInfo(); } - // Map to the Command specified by the extra path info - Catalog catalog = (Catalog) context.get(getCatalogKey()); - Command command = catalog.getCommand(pathInfo); - return (command.execute(context)); + return pathInfo; } Index: /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/RequestParameterMapper.java =================================================================== --- /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/RequestParameterMapper.java (revision 157634) +++ /Users/germuska/Development/jakarta/commons/chain/src/java/org/apache/commons/chain/web/servlet/RequestParameterMapper.java (working copy) @@ -35,44 +35,16 @@ * @author Craig R. McClanahan */ -public class RequestParameterMapper implements Command { +public class RequestParameterMapper extends AbstractMapper implements Command { // ------------------------------------------------------ Instance Variables - - - private String catalogKey = ChainProcessor.CATALOG_DEFAULT; private String parameter = "command"; // -------------------------------------------------------------- Properties - /** - *Return the context key under which our {@link Catalog} has been - * stored.
- */ - public String getCatalogKey() { - - return (this.catalogKey); - - } - - - /** - *Set the context key under which our {@link Catalog} has been - * stored.
- * - * @param catalogKey The new catalog key - */ - public void setCatalogKey(String catalogKey) { - - this.catalogKey = catalogKey; - - } - - - /** *Return the name of the request parameter to use for * selecting the {@link Command} to be executed.
*/ @@ -105,18 +77,13 @@ * * @param context Context for the current request */ - public boolean execute(Context context) throws Exception { + public String getCommandName(Context context) { // Look up the specified request parameter for this request ServletWebContext swcontext = (ServletWebContext) context; HttpServletRequest request = swcontext.getRequest(); - String value = request.getParameter(getParameter()); + return request.getParameter(getParameter()); - // Map to the Command specified by the extra path info - Catalog catalog = (Catalog) context.get(getCatalogKey()); - Command command = catalog.getCommand(value); - return (command.execute(context)); - }