open class DefaultRequestToViewNameTranslator : RequestToViewNameTranslator
RequestToViewNameTranslator that simply transforms the URI of the incoming request into a view name.
Can be explicitly defined as the viewNameTranslator
bean in a org.springframework.web.servlet.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
Author
Rob Harrop
Author
Juergen Hoeller
Since
2.0
See Also
org.springframework.web.servlet.RequestToViewNameTranslatororg.springframework.web.servlet.ViewResolver
DefaultRequestToViewNameTranslator()
RequestToViewNameTranslator that simply transforms the URI of the incoming request into a view name. Can be explicitly defined as the 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 The stripping of the leading slash and file extension can be disabled using the Find below some examples of request to view name translation.
|
open fun getViewName(request: HttpServletRequest): String
Translates the request URI of the incoming HttpServletRequest into the view name based on the configured parameters. |
|
open fun setAlwaysUseFullPath(alwaysUseFullPath: Boolean): Unit
Shortcut to same property on underlying |
|
open fun setPrefix(prefix: String): Unit
Set the prefix to prepend to generated view names. |
|
open fun setRemoveSemicolonContent(removeSemicolonContent: Boolean): Unit
Set if ";" (semicolon) content should be stripped from the request URI. |
|
open fun setSeparator(separator: String): Unit
Set the value that will replace ' |
|
open fun setStripExtension(stripExtension: Boolean): Unit
Set whether or not file extensions should be stripped from the URI when generating the view name. Default is "true". |
|
open fun setStripLeadingSlash(stripLeadingSlash: Boolean): Unit
Set whether or not leading slashes should be stripped from the URI when generating the view name. Default is "true". |
|
open fun setStripTrailingSlash(stripTrailingSlash: Boolean): Unit
Set whether or not trailing slashes should be stripped from the URI when generating the view name. Default is "true". |
|
open fun setSuffix(suffix: String): Unit
Set the suffix to append to generated view names. |
|
open fun setUrlDecode(urlDecode: Boolean): Unit
Shortcut to same property on underlying |
|
open fun setUrlPathHelper(urlPathHelper: UrlPathHelper): Unit
Set the org.springframework.web.util.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. |