|
How to use AbstractController for caching support in Spring |
|
|
This example will show the way to add a AbstractController in the Spring framework.
ExampleController.java
package examples;
public class ExampleController extends AbstractController {
public ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception
{
ModelAndView mav = new ModelAndView("foo");
mav.addObject("message", "Hello World!");
return mav;
}
}
|
Add following code in Dispatcher Servlet XML Configuration File so as to generate caching directives directing client to cache things for 2 minutes before rechecking.
<bean id="sampleController" class="Examples.ExampleController">
<property name="cacheSeconds" value="120"/>
</bean>
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.