Click here to Skip to main content
15,887,214 members
Home / Discussions / Java
   

Java

 
AnswerRe: java Pin
Richard MacCutchan1-May-14 5:34
mveRichard MacCutchan1-May-14 5:34 
Questionplease reply as soon as possible Pin
Member 107875691-May-14 0:36
Member 107875691-May-14 0:36 
AnswerRe: please reply as soon as possible Pin
Richard MacCutchan1-May-14 0:50
mveRichard MacCutchan1-May-14 0:50 
GeneralRe: please reply as soon as possible Pin
Member 107875691-May-14 17:59
Member 107875691-May-14 17:59 
GeneralRe: please reply as soon as possible Pin
thatraja1-May-14 21:00
professionalthatraja1-May-14 21:00 
AnswerRe: please reply as soon as possible Pin
Member 1026233013-May-14 21:41
Member 1026233013-May-14 21:41 
QuestionIE not getting refresh to show the latest changes--spring MVC,jsp Pin
swarjava30-Apr-14 8:06
swarjava30-Apr-14 8:06 
AnswerRe: IE not getting refresh to show the latest changes--spring MVC,jsp Pin
Prasad Khandekar14-May-14 3:13
professionalPrasad Khandekar14-May-14 3:13 
Hello,

If you are using BaseFormController or MultiActionControllers then in your XML configuration file set cacheSeconds to 0. This will force controller to automatically output the cache control headers. If you are using annotated controllers then you can use a bean post processor and in it for Bean of type WebContentGenerator set cacheSeconds to 0. Please find below the sample Bean Post Processor
Java
package org.freeware.bizsutra.utils;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;

/**
 * <a href="/Members/author">@author</a> Prasad Khandekar
 * <a href="/Members/Version">@version</a> 1.0
 */
public class DefaultPostBeanProcessor implements BeanPostProcessor
{
    int    _intCacheSec = 0;
    ConfigurableWebBindingInitializer _webBindingInitializer = null;

    public int getCacheSeconds()
    {
        return _intCacheSec;
    }

    public void setCacheSeconds(int cacheSeconds)
    {
        _intCacheSec = cacheSeconds;
    }

    public ConfigurableWebBindingInitializer getWebBindingInitializer()
    {
        return _webBindingInitializer;
    }

    public void setWebBindingInitializer(ConfigurableWebBindingInitializer webBindingInitializer)
    {
        _webBindingInitializer = webBindingInitializer;
    }

    /*
     * (non-Javadoc)
     * 
     * <a href="/Members/See">@see</a> org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
     */
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
    {

        if (bean instanceof RequestMappingHandlerAdapter)
        {
            // Set No Cache for all Annotated Controller responses.
            ((RequestMappingHandlerAdapter) bean).setCacheSeconds(0);
            ((RequestMappingHandlerAdapter) bean).setWebBindingInitializer(webBindingInitializer);
        }
        return bean;
    }

    /*
     * (non-Javadoc)
     * 
     * <a href="/Members/See">@see</a> org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
     */
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
    {
        return bean;
    }
}

Regards,
<div class="signature">Prasad P. Khandekar
Knowledge exists, man only discovers it.</div>

QuestionGet data from database Pin
Ravi900kumar29-Apr-14 8:48
Ravi900kumar29-Apr-14 8:48 
QuestionRe: Get data from database Pin
Richard MacCutchan29-Apr-14 20:32
mveRichard MacCutchan29-Apr-14 20:32 
AnswerRe: Get data from database Pin
Tom Marvolo Riddle29-Apr-14 23:07
professionalTom Marvolo Riddle29-Apr-14 23:07 
QuestionNeed help on "Competition Scheduling" Algorithm Pin
N.Wang29-Apr-14 7:11
professionalN.Wang29-Apr-14 7:11 
SuggestionRe: Need help on "Competition Scheduling" Algorithm Pin
Richard MacCutchan29-Apr-14 20:31
mveRichard MacCutchan29-Apr-14 20:31 
QuestionHSQL where clause Pin
Nico Haegens29-Apr-14 6:43
professionalNico Haegens29-Apr-14 6:43 
AnswerRe: HSQL where clause Pin
Richard MacCutchan29-Apr-14 20:29
mveRichard MacCutchan29-Apr-14 20:29 
GeneralRe: HSQL where clause Pin
Nico Haegens29-Apr-14 20:59
professionalNico Haegens29-Apr-14 20:59 
GeneralRe: HSQL where clause Pin
Richard MacCutchan29-Apr-14 21:07
mveRichard MacCutchan29-Apr-14 21:07 
GeneralRe: HSQL where clause Pin
Nico Haegens29-Apr-14 21:18
professionalNico Haegens29-Apr-14 21:18 
GeneralRe: HSQL where clause Pin
Richard MacCutchan29-Apr-14 21:23
mveRichard MacCutchan29-Apr-14 21:23 
QuestionJava file reading Pin
monikanchan28-Apr-14 18:17
monikanchan28-Apr-14 18:17 
GeneralRe: Java file reading Pin
Richard MacCutchan28-Apr-14 22:31
mveRichard MacCutchan28-Apr-14 22:31 
AnswerRe: Java file reading Pin
Doan Vu6-Jun-14 17:03
professionalDoan Vu6-Jun-14 17:03 
Questionget value inside array list in specific order Pin
sunil khichar28-Apr-14 7:36
sunil khichar28-Apr-14 7:36 
AnswerRe: get value inside array list in specific order Pin
jschell28-Apr-14 8:07
jschell28-Apr-14 8:07 
QuestionJSP VS ASP.net Pin
Kokkula27-Apr-14 18:53
Kokkula27-Apr-14 18:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.