类 UrlFilenameViewController
java.lang.Object
cn.taketoday.context.support.ApplicationObjectSupport
cn.taketoday.web.WebContentGenerator
cn.taketoday.web.handler.mvc.AbstractController
cn.taketoday.web.handler.mvc.AbstractUrlViewController
cn.taketoday.web.handler.mvc.UrlFilenameViewController
- 所有已实现的接口:
cn.taketoday.beans.factory.Aware,cn.taketoday.context.ApplicationContextAware,Controller,HttpRequestHandler
Simple
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!
- 从以下版本开始:
- 4.0 2022/2/8 17:06
- 作者:
- Alef Arendsen, Juergen Hoeller, Rob Harrop, Harry Yang
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private Stringprivate booleanprivate StringRequest URL path String to view name String.从类继承的字段 cn.taketoday.web.WebContentGenerator
HEADER_CACHE_CONTROL, METHOD_GET, METHOD_HEAD, METHOD_POST从类继承的字段 cn.taketoday.context.support.ApplicationObjectSupport
applicationContext, log, messageSourceAccessor从接口继承的字段 cn.taketoday.web.HttpRequestHandler
NONE_RETURN_VALUE -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected StringextractOperableUrl(RequestContext request) Extract a URL path from the given request, suitable for view name extraction.protected StringExtract the URL filename from the given request URI.protected StringReturn the prefix to prepend to the request URL filename.protected StringReturn the suffix to append to the request URL filename.protected StringgetViewNameForRequest(RequestContext request) Returns view name based on the URL filename, with prefix/suffix applied when appropriate.protected StringReturns view name based on the URL filename, with prefix/suffix applied when appropriate.protected StringpostProcessViewName(String viewName) Build the full view name based on the given view name as indicated by the URL path.voidSet the prefix to prepend to the request URL filename to build a view name.voidsetRemoveSemicolonContent(boolean removeSemicolonContent) Set if ";" (semicolon) content should be stripped from the request URI.voidSet the suffix to append to the request URL filename to build a view name.从类继承的方法 cn.taketoday.web.handler.mvc.AbstractUrlViewController
handleRequestInternal从类继承的方法 cn.taketoday.web.handler.mvc.AbstractController
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession从类继承的方法 cn.taketoday.web.WebContentGenerator
applyCacheControl, applyCacheSeconds, checkRequest, getAllowHeader, getCacheControl, getCacheSeconds, getSupportedMethods, getVaryByRequestHeaders, isRequireSession, prepareResponse, setCacheControl, setCacheSeconds, setRequireSession, setSupportedMethods, setVaryByRequestHeaders从类继承的方法 cn.taketoday.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, initApplicationContext, isContextRequired, obtainApplicationContext, requiredContextClass, setApplicationContext, unwrapContext, unwrapFactory
-
字段详细资料
-
prefix
-
suffix
-
removeSemicolonContent
private boolean removeSemicolonContent -
viewNameCache
Request URL path String to view name String.
-
-
构造器详细资料
-
UrlFilenameViewController
public UrlFilenameViewController()
-
-
方法详细资料
-
setPrefix
Set the prefix to prepend to the request URL filename to build a view name. -
getPrefix
Return the prefix to prepend to the request URL filename. -
setSuffix
Set the suffix to append to the request URL filename to build a view name. -
getSuffix
Return the suffix to append to the request URL filename. -
setRemoveSemicolonContent
public void setRemoveSemicolonContent(boolean removeSemicolonContent) Set if ";" (semicolon) content should be stripped from the request URI.Default is "true".
-
getViewNameForRequest
Returns view name based on the URL filename, with prefix/suffix applied when appropriate.- 指定者:
getViewNameForRequest在类中AbstractUrlViewController- 参数:
request- current HTTP request- 返回:
- a view name for this request (never
null) - 另请参阅:
-
extractOperableUrl
Extract a URL path from the given request, suitable for view name extraction.- 参数:
request- current HTTP request- 返回:
- the URL to use for view name extraction
-
getViewNameForUrlPath
Returns view name based on the URL filename, with prefix/suffix applied when appropriate.- 参数:
uri- the request URI; for example"/index.html"- 返回:
- the extracted URI filename; for example
"index" - 另请参阅:
-
extractViewNameFromUrlPath
Extract the URL filename from the given request URI.- 参数:
uri- the request URI; for example"/index.html"- 返回:
- the extracted URI filename; for example
"index"
-
postProcessViewName
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.
- 参数:
viewName- the original view name, as indicated by the URL path- 返回:
- the full view name to use
- 另请参阅:
-