1 16 17 package org.springframework.web.servlet.mvc.multiaction; 18 19 import javax.servlet.http.HttpServletRequest ; 20 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 24 import org.springframework.web.util.UrlPathHelper; 25 26 38 public abstract class AbstractUrlMethodNameResolver implements MethodNameResolver { 39 40 41 protected final Log logger = LogFactory.getLog(getClass()); 42 43 private UrlPathHelper urlPathHelper = new UrlPathHelper(); 44 45 46 53 public void setAlwaysUseFullPath(boolean alwaysUseFullPath) { 54 this.urlPathHelper.setAlwaysUseFullPath(alwaysUseFullPath); 55 } 56 57 68 public void setUrlDecode(boolean urlDecode) { 69 this.urlPathHelper.setUrlDecode(urlDecode); 70 } 71 72 79 public void setUrlPathHelper(UrlPathHelper urlPathHelper) { 80 this.urlPathHelper = urlPathHelper; 81 } 82 83 84 90 public final String getHandlerMethodName(HttpServletRequest request) 91 throws NoSuchRequestHandlingMethodException { 92 93 String urlPath = this.urlPathHelper.getLookupPathForRequest(request); 94 String name = getHandlerMethodNameForUrlPath(urlPath); 95 if (name == null) { 96 throw new NoSuchRequestHandlingMethodException(request); 97 } 98 if (logger.isDebugEnabled()) { 99 logger.debug("Returning handler method name '" + name + "' for lookup path: " + urlPath); 100 } 101 return name; 102 } 103 104 115 protected abstract String getHandlerMethodNameForUrlPath(String urlPath); 116 117 } 118 | Popular Tags |