java.lang.Object | |
↳ | org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator |
RequestToViewNameTranslator
that simply transforms the URI of the incoming request into a view name.
Can be explicitly defined as the "viewNameTranslator" bean in a
DispatcherServlet
context.
Otherwise, a plain default instance will be used.
The default transformation simply strips leading and trailing slashes
as well as the file extension of the URI, and returns the result as the
view name with the configured "prefix"
and a
"suffix"
added as appropriate.
The stripping of the leading slash and file extension can be disabled
using the "stripLeadingSlash"
and
"stripExtension"
properties, respectively.
Find below some examples of request to view name translation.
http://localhost:8080/gamecast/display.html -> display http://localhost:8080/gamecast/displayShoppingCart.html -> displayShoppingCart http://localhost:8080/gamecast/admin/index.html -> admin/index
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Translates the request URI of the incoming HttpServletRequest
into the view name based on the configured parameters.
| |||||||||||
Set if URL lookup should always use the full path within the current servlet
context.
| |||||||||||
Set the prefix to prepend to generated view names.
| |||||||||||
Set the value that will replace '
/ ' as the separator
in the view name. | |||||||||||
Set whether or not file extensions should be stripped from the URI when
generating the view name.
| |||||||||||
Set whether or not leading slashes should be stripped from the URI when
generating the view name.
| |||||||||||
Set whether or not trailing slashes should be stripped from the URI when
generating the view name.
| |||||||||||
Set the suffix to append to generated view names.
| |||||||||||
Set if the context path and request URI should be URL-decoded.
| |||||||||||
Set the
UrlPathHelper to use for
the resolution of lookup paths. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Transform the request URI (in the context of the webapp) stripping
slashes and extensions, and replacing the separator as required.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.web.servlet.RequestToViewNameTranslator
|
Translates the request URI of the incoming HttpServletRequest into the view name based on the configured parameters.
request | the incoming HttpServletRequest providing the context from which a view name is to be resolved |
---|
null
if no default found)Set if URL lookup should always use the full path within the current servlet context. Else, the path within the current servlet mapping is used if applicable (i.e. in the case of a ".../*" servlet mapping in web.xml). Default is "false".
Set the prefix to prepend to generated view names.
prefix | the prefix to prepend to generated view names |
---|
Set the value that will replace '/
' as the separator
in the view name. The default behavior simply leaves '/
'
as the separator.
Set whether or not file extensions should be stripped from the URI when generating the view name. Default is "true".
Set whether or not leading slashes should be stripped from the URI when generating the view name. Default is "true".
Set whether or not trailing slashes should be stripped from the URI when generating the view name. Default is "true".
Set the suffix to append to generated view names.
suffix | the suffix to append to generated view names |
---|
Set if the context path and request URI should be URL-decoded. Both are returned undecoded by the Servlet API, in contrast to the servlet path.
Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).
Set the UrlPathHelper
to use for
the resolution of lookup paths.
Use this to override the default UrlPathHelper with a custom subclass, or to share common UrlPathHelper settings across multiple web components.
Transform the request URI (in the context of the webapp) stripping slashes and extensions, and replacing the separator as required.
lookupPath | the lookup path for the current request, as determined by the UrlPathHelper |
---|