|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
public class UrlFilenameViewController
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!
setPrefix(java.lang.String)
,
setSuffix(java.lang.String)
Field Summary |
---|
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator |
---|
HEADER_CACHE_CONTROL, HEADER_EXPIRES, HEADER_PRAGMA, METHOD_GET, METHOD_HEAD, METHOD_POST |
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
UrlFilenameViewController()
|
Method Summary | |
---|---|
protected String |
extractViewNameFromUrlPath(String uri)
Extract the URL filename from the given request URI. |
protected String |
getPrefix()
Return the prefix to prepend to the request URL filename. |
protected String |
getSuffix()
Return the suffix to append to the request URL filename. |
protected String |
getViewNameForUrlPath(String urlPath)
Returns view name based on the URL filename, with prefix/suffix applied when appropriate. |
protected String |
postProcessViewName(String viewName)
Build the full view name based on the given view name as indicated by the URL path. |
void |
setPrefix(String prefix)
Set the prefix to prepend to the request URL filename to build a view name. |
void |
setSuffix(String suffix)
Set the suffix to append to the request URL filename to build a view name. |
Methods inherited from class org.springframework.web.servlet.mvc.AbstractUrlViewController |
---|
handleRequestInternal, setAlwaysUseFullPath, setUrlDecode, setUrlPathHelper |
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController |
---|
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession |
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 org.springframework.web.context.support.WebApplicationObjectSupport |
---|
getServletContext, getTempDir, getWebApplicationContext, isContextRequired |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UrlFilenameViewController()
Method Detail |
---|
public void setPrefix(String prefix)
protected String getPrefix()
public void setSuffix(String suffix)
protected String getSuffix()
protected String getViewNameForUrlPath(String urlPath)
getViewNameForUrlPath
in class AbstractUrlViewController
urlPath
- the URL path to use for lookup,
according to the settings in this class
null
)extractViewNameFromUrlPath(java.lang.String)
,
setPrefix(java.lang.String)
,
setSuffix(java.lang.String)
protected String extractViewNameFromUrlPath(String uri)
WebUtils.extractViewNameFromUrlPath(String)
.
uri
- the request URI (e.g. "/index.html")
WebUtils.extractFilenameFromUrlPath(java.lang.String)
protected String postProcessViewName(String viewName)
The default implementation simply applies prefix and suffix. This can be overridden, for example, to manipulate upper case / lower case, etc.
viewName
- the original view name, as indicated by the URL path
getPrefix()
,
getSuffix()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |