org.apache.struts2.dispatcher
类 DefaultStaticContentLoader

java.lang.Object
  继承者 org.apache.struts2.dispatcher.DefaultStaticContentLoader
所有已实现的接口:
StaticContentLoader

public class DefaultStaticContentLoader
extends Object
implements StaticContentLoader

Default implementation to server static content

This class is used to serve common static content needed when using various parts of Struts, such as JavaScript files, CSS files, etc. It works by looking for requests to /struts/* (or /static/*), and then mapping the value after "/struts/" to common packages in Struts and, optionally, in your class path. By default, the following packages are automatically searched:

This means that you can simply request /struts/xhtml/styles.css and the XHTML UI theme's default stylesheet will be returned. Likewise, many of the AJAX UI components require various JavaScript files, which are found in the org.apache.struts2.static package. If you wish to add additional packages to be searched, you can add a comma separated (space, tab and new line will do as well) list in the filter init parameter named "packages". Be careful, however, to expose any packages that may have sensitive information, such as properties file with database access credentials.


构造方法摘要
DefaultStaticContentLoader()
           
 
方法摘要
 boolean canHandle(String resourcePath)
           
 void findStaticResource(String path, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Locate a static resource and copy directly to the response, setting the appropriate caching headers.
 void setEncoding(String val)
          Modify state of StrutsConstants.STRUTS_I18N_ENCODING setting.
 void setHostConfig(HostConfig filterConfig)
           
 void setServeStaticBrowserCache(String val)
          Modify state of StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE setting.
 void setServeStaticContent(String val)
          Modify state of StrutsConstants.STRUTS_SERVE_STATIC_CONTENT setting.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

DefaultStaticContentLoader

public DefaultStaticContentLoader()
方法详细信息

setServeStaticContent

public void setServeStaticContent(String val)
Modify state of StrutsConstants.STRUTS_SERVE_STATIC_CONTENT setting.

参数:
val - New setting

setServeStaticBrowserCache

public void setServeStaticBrowserCache(String val)
Modify state of StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE setting.

参数:
val - New setting

setEncoding

public void setEncoding(String val)
Modify state of StrutsConstants.STRUTS_I18N_ENCODING setting.

参数:
val - New setting

setHostConfig

public void setHostConfig(HostConfig filterConfig)
指定者:
接口 StaticContentLoader 中的 setHostConfig
参数:
filterConfig - The filter configuration

findStaticResource

public void findStaticResource(String path,
                               javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws IOException
从接口 StaticContentLoader 复制的描述
Locate a static resource and copy directly to the response, setting the appropriate caching headers.

指定者:
接口 StaticContentLoader 中的 findStaticResource
参数:
path - The resource name
request - The request
response - The response
抛出:
IOException - If anything goes wrong

canHandle

public boolean canHandle(String resourcePath)
指定者:
接口 StaticContentLoader 中的 canHandle
参数:
resourcePath - Requested resource path
返回:
true if this loader is able to load this type of resource, false otherwise