Class UrlFilenameViewController
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.support.WebContentGenerator
org.springframework.web.servlet.mvc.AbstractController
org.springframework.web.servlet.mvc.AbstractUrlViewController
org.springframework.web.servlet.mvc.UrlFilenameViewController
- All Implemented Interfaces:
- Aware,- ApplicationContextAware,- ServletContextAware,- Controller
Simple 
Controller implementation that transforms the virtual
 path of a URL into a view name and returns that view.
 Can optionally prepend a prefix and/or append a
 suffix to build the viewname from the URL filename.
 
Find some examples below:
- "/index" -> "index"
- "/index.html" -> "index"
- "/index.html"+ prefix- "pre_"and suffix- "_suf" -> "pre_index_suf"
- "/products/view.html" -> "products/view"
Thanks to David Barri for suggesting prefix/suffix support!
- Author:
- Alef Arendsen, Juergen Hoeller, Rob Harrop
- See Also:
- 
Field SummaryFields inherited from class org.springframework.web.servlet.support.WebContentGeneratorHEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POSTFields inherited from class org.springframework.context.support.ApplicationObjectSupportlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected StringextractOperableUrl(HttpServletRequest request) Extract a URL path from the given request, suitable for view name extraction.protected StringExtract the URL filename from the given request URI.protected StringReturn the prefix to prepend to the request URL filename.protected StringReturn the suffix to append to the request URL filename.protected StringgetViewNameForRequest(HttpServletRequest request) Returns view name based on the URL filename, with prefix/suffix applied when appropriate.protected StringReturns view name based on the URL filename, with prefix/suffix applied when appropriate.protected StringpostProcessViewName(String viewName) Build the full view name based on the given view name as indicated by the URL path.voidSet the prefix to prepend to the request URL filename to build a view name.voidSet the suffix to append to the request URL filename to build a view name.Methods inherited from class org.springframework.web.servlet.mvc.AbstractUrlViewControllergetUrlPathHelper, handleRequestInternal, setAlwaysUseFullPath, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelperMethods inherited from class org.springframework.web.servlet.mvc.AbstractControllerhandleRequest, isSynchronizeOnSession, setSynchronizeOnSessionMethods inherited from class org.springframework.web.servlet.support.WebContentGeneratorapplyCacheControl, applyCacheSeconds, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isRequireSession, prepareResponse, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setVaryByRequestHeadersMethods inherited from class org.springframework.web.context.support.WebApplicationObjectSupportgetServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextMethods inherited from class org.springframework.context.support.ApplicationObjectSupportgetApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext
- 
Constructor Details- 
UrlFilenameViewControllerpublic UrlFilenameViewController()
 
- 
- 
Method Details- 
setPrefix
- 
getPrefixReturn the prefix to prepend to the request URL filename.
- 
setSuffix
- 
getSuffixReturn the suffix to append to the request URL filename.
- 
getViewNameForRequestReturns view name based on the URL filename, with prefix/suffix applied when appropriate.- Specified by:
- getViewNameForRequestin class- AbstractUrlViewController
- Parameters:
- request- current HTTP request
- Returns:
- a view name for this request (never null)
- See Also:
 
- 
extractOperableUrlExtract a URL path from the given request, suitable for view name extraction.- Parameters:
- request- current HTTP request
- Returns:
- the URL to use for view name extraction
 
- 
getViewNameForUrlPath
- 
extractViewNameFromUrlPath
- 
postProcessViewNameBuild the full view name based on the given view name as indicated by the URL path.The default implementation simply applies prefix and suffix. This can be overridden, for example, to manipulate upper case / lower case, etc. - Parameters:
- viewName- the original view name, as indicated by the URL path
- Returns:
- the full view name to use
- See Also:
 
 
-