1 16 package org.apache.commons.chain.web.servlet; 17 18 19 import javax.servlet.http.HttpServletRequest ; 20 import org.apache.commons.chain.Catalog; 21 import org.apache.commons.chain.Command; 22 import org.apache.commons.chain.Context; 23 24 25 36 37 public class PathInfoMapper implements Command { 38 39 40 42 43 private String catalogKey = ChainProcessor.CATALOG_DEFAULT; 44 45 46 48 49 53 public String getCatalogKey() { 54 55 return (this.catalogKey); 56 57 } 58 59 60 66 public void setCatalogKey(String catalogKey) { 67 68 this.catalogKey = catalogKey; 69 70 } 71 72 73 75 76 82 public boolean execute(Context context) throws Exception { 83 84 ServletWebContext swcontext = (ServletWebContext) context; 86 HttpServletRequest request = swcontext.getRequest(); 87 String pathInfo = (String ) 88 request.getAttribute("javax.servlet.include.path_info"); 89 if (pathInfo == null) { 90 pathInfo = request.getPathInfo(); 91 } 92 93 Catalog catalog = (Catalog) context.get(getCatalogKey()); 95 Command command = catalog.getCommand(pathInfo); 96 return (command.execute(context)); 97 98 } 99 100 101 } 102 | Popular Tags |