Package org.apache.struts2.dispatcher
Interface StaticContentLoader
- All Known Implementing Classes:
DefaultStaticContentLoader
public interface StaticContentLoader
Interface for loading static resources, based on a path. After implementing your own static content loader
you must tell the framework how to use it, eg.
<bean name="myContentLoader" type="org.apache.struts2.dispatcher" class="com.company.struts.MyContentLoader"/>
<constant name="struts.staticContentLoader" value="myContentLoader"/>
Check
StrutsBeanSelectionProvider
for more details.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Default path at which static content is served, can be changed by usingStrutsConstants.STRUTS_UI_STATIC_CONTENT_PATH
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
findStaticResource
(String path, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Locate a static resource and copy directly to the response, setting the appropriate caching headers.void
setHostConfig
(HostConfig filterConfig)
-
Field Details
-
DEFAULT_STATIC_CONTENT_PATH
Default path at which static content is served, can be changed by usingStrutsConstants.STRUTS_UI_STATIC_CONTENT_PATH
- See Also:
-
-
Method Details
-
canHandle
- Parameters:
path
- Requested resource path- Returns:
- true if this loader is able to load this type of resource, false otherwise
-
setHostConfig
- Parameters:
filterConfig
- The filter configuration
-
findStaticResource
void findStaticResource(String path, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException Locate a static resource and copy directly to the response, setting the appropriate caching headers.- Parameters:
path
- The resource namerequest
- The requestresponse
- The response- Throws:
IOException
- If anything goes wrong
-