|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
public class ResourceHandlerRegistry
Stores registrations of resource handlers for serving static resources such as images, css files and others through Spring MVC including setting cache headers optimized for efficient loading in a web browser. Resources can be served out of locations under web application root, from the classpath, and others.
To create a resource handler, use addResourceHandler(String...)
providing the URL path patterns
for which the handler should be invoked to serve static resources (e.g. "/resources/**"
).
Then use additional methods on the returned ResourceHandlerRegistration
to add one or more
locations from which to serve static content from (e.g. {"/"
,
"classpath:/META-INF/public-web-resources/"
}) or to specify a cache period for served resources.
DefaultServletHandlerConfigurer
Constructor Summary | |
---|---|
ResourceHandlerRegistry(ApplicationContext applicationContext,
ServletContext servletContext)
|
Method Summary | |
---|---|
ResourceHandlerRegistration |
addResourceHandler(String... pathPatterns)
Add a resource handler for serving static resources based on the specified URL path patterns. |
protected AbstractHandlerMapping |
getHandlerMapping()
Return a handler mapping with the mapped resource handlers; or null in case of no registrations. |
ResourceHandlerRegistry |
setOrder(int order)
Specify the order to use for resource handling relative to other HandlerMapping s configured in
the Spring MVC application context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceHandlerRegistry(ApplicationContext applicationContext, ServletContext servletContext)
Method Detail |
---|
public ResourceHandlerRegistration addResourceHandler(String... pathPatterns)
ResourceHandlerRegistration
to use to further configure the registered resource handler.public ResourceHandlerRegistry setOrder(int order)
HandlerMapping
s configured in
the Spring MVC application context. The default value used is Integer.MAX_VALUE-1
.
protected AbstractHandlerMapping getHandlerMapping()
null
in case of no registrations.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |