org.springframework.web.servlet.mvc
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.UrlFilenameViewController
- All Implemented Interfaces:
- ApplicationContextAware, Controller
public class UrlFilenameViewController
- extends AbstractController
Controller that transforms the virtual filename at the end 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.
Example: "/index" -> "index"
Example: "/index.html" -> "index"
Example: "/index.html" + prefix "pre_" and suffix "_suf" -> "pre_index_suf".
Thanks to David Barri for suggesting prefix/suffix support!
- Author:
- Alef Arendsen, Juergen Hoeller
- See Also:
setPrefix(java.lang.String)
,
setSuffix(java.lang.String)
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator |
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseExpiresHeader |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UrlFilenameViewController
public UrlFilenameViewController()
setPrefix
public void setPrefix(String prefix)
- Set the prefix that gets prepended to the request URL filename
to build a view name.
setSuffix
public void setSuffix(String suffix)
- Set the suffix that gets appended to the request URL filename
to build a view name.
handleRequestInternal
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response)
- Returns a ModelAndView with the view name being the URL filename,
with prefix/suffix applied when appropriate.
- Specified by:
handleRequestInternal
in class AbstractController
- See Also:
getFilenameFromRequestURI(java.lang.String)
,
setPrefix(java.lang.String)
,
setSuffix(java.lang.String)
getFilenameFromRequestURI
protected String getFilenameFromRequestURI(String uri)
- Extract the URL filename from the given request URI
- Parameters:
uri
- the request URI (e.g. "/index.html")
- Returns:
- the extracted URI filename (e.g. "index")
- See Also:
HttpServletRequest.getRequestURI()
Copyright (c) 2002-2005 The Spring Framework Project.