1 16 17 package org.springframework.web.servlet.mvc; 18 19 import javax.servlet.http.HttpServletRequest ; 20 import javax.servlet.http.HttpServletResponse ; 21 22 import org.springframework.web.servlet.ModelAndView; 23 import org.springframework.web.util.UrlPathHelper; 24 25 38 public abstract class AbstractUrlViewController extends AbstractController { 39 40 private UrlPathHelper urlPathHelper = new UrlPathHelper(); 41 42 43 50 public void setAlwaysUseFullPath(boolean alwaysUseFullPath) { 51 this.urlPathHelper.setAlwaysUseFullPath(alwaysUseFullPath); 52 } 53 54 65 public void setUrlDecode(boolean urlDecode) { 66 this.urlPathHelper.setUrlDecode(urlDecode); 67 } 68 69 76 public void setUrlPathHelper(UrlPathHelper urlPathHelper) { 77 this.urlPathHelper = urlPathHelper; 78 } 79 80 83 protected UrlPathHelper getUrlPathHelper() { 84 return this.urlPathHelper; 85 } 86 87 88 92 protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { 93 String lookupPath = getUrlPathHelper().getLookupPathForRequest(request); 94 String viewName = getViewNameForRequest(request); 95 if (logger.isDebugEnabled()) { 96 logger.debug("Returning view name '" + viewName + "' for lookup path [" + lookupPath + "]"); 97 } 98 return new ModelAndView(viewName); 99 } 100 101 110 protected abstract String getViewNameForRequest(HttpServletRequest request); 111 112 } 113 | Popular Tags |