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!
setPrefix, setSuffix
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private String | |
| private final Map | viewNameCache
Request URL path String to view name String. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected String | Returns: the URL to use for view name extractioncurrent HTTP request request)Extract a URL path from the given request, suitable for view name extraction. |
| protected String | Returns: the extracted URI filename; for example"index"the request URI; for example uri)"/index.html"Extract the URL filename from the given request URI. |
| protected String | |
| protected String | |
| protected String | getViewNameForRequest(HttpServletRequest
current HTTP request request)Implements abstract org. Returns view name based on the URL filename, with prefix/suffix applied when appropriate. |
| protected String | Returns: the extracted URI filename; for example"index"the request URI; for example uri)"/index.html"Returns view name based on the URL filename, with prefix/suffix applied when appropriate. |
| protected String | Returns: the full view name to usethe original view name, as indicated by the URL path viewName)Build the full view name based on the given view name as indicated by the URL path. |
| public void | |
| public void |
| prefix | back to summary |
|---|---|
| private String prefix | |
| suffix | back to summary |
|---|---|
| private String suffix | |
| viewNameCache | back to summary |
|---|---|
| private final Map<String, String> viewNameCache Request URL path String to view name String. | |
| UrlFilenameViewController | back to summary |
|---|---|
| public UrlFilenameViewController() | |
| extractOperableUrl | back to summary |
|---|---|
| protected String extractOperableUrl(HttpServletRequest request) Extract a URL path from the given request, suitable for view name extraction.
| |
| extractViewNameFromUrlPath | back to summary |
|---|---|
| protected String extractViewNameFromUrlPath(String uri) Extract the URL filename from the given request URI. | |
| getPrefix | back to summary |
|---|---|
| protected String getPrefix() Return the prefix to prepend to the request URL filename. | |
| getSuffix | back to summary |
|---|---|
| protected String getSuffix() Return the suffix to append to the request URL filename. | |
| getViewNameForRequest | back to summary |
|---|---|
| protected String getViewNameForRequest(HttpServletRequest request) Implements abstract org. Returns view name based on the URL filename, with prefix/suffix applied when appropriate.
| |
| getViewNameForUrlPath | back to summary |
|---|---|
| protected String getViewNameForUrlPath(String uri) Returns view name based on the URL filename, with prefix/suffix applied when appropriate.
| |
| postProcessViewName | back to summary |
|---|---|
| protected String postProcessViewName(String viewName) Build 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.
| |
| setPrefix | back to summary |
|---|---|
| public void setPrefix(String prefix) Set the prefix to prepend to the request URL filename to build a view name. | |
| setSuffix | back to summary |
|---|---|
| public void setSuffix(String suffix) Set the suffix to append to the request URL filename to build a view name. | |