Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8856801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:26:22+00:00 2026-06-14T14:26:22+00:00

I have an issue that my application deployment always returns response headers with: Cache-Control:

  • 0

I have an issue that my application deployment always returns response headers with:

Cache-Control: no-cache
Cache-Control: no-store
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:no-cache

I’m using:

Spring 3.1.2.RELEASE

Primefaces JSF 3.4.1

Spring Webflow 2.3.0.RELEASE

JBoss AS 7.0.1

I’ve tried nearly every solution on the application side I could find:

  1. Configuring the WebContentInterceptor (tried various permutations of it) Right out of the box cache-control header filter?
  2. Writing a custom interceptor that adds different Cache-Control header (tested with Cache-Control: private)
  3. Writing a customer filter that adds HTTP response parameters. Configure it with Cache-Control: private as init-params in web.xml
  4. Use the context.xml file (tried both in META-INF/ and WEB-INF/) to disable the Cache-Control in JBoss/Tomcat http://daveharris.wordpress.com/2007/07/09/how-to-configure-cache-control-in-tomcat/

In all of the above cases, the response headers never ended up different, always no-cache, no-store, 1970 expires, pragma: no-cache

I’m running out of ideas, does anyone know what is setting these headers in my response so I can target the appropriate deployment component to resolve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:26:23+00:00Added an answer on June 14, 2026 at 2:26 pm

    The root code causing this is in Spring MVC, called from the WebContentGenerator. This class is used as base class for several classes in the MVC/Webflow stack: WebContentInterceptor (MVC interceptor), AbstractController (MVC controller), AbstractHandlerMethodAdapter (MVC HandlerAdapter), AnnotationMethodHadlerAdapter (MVC HandlerAdapter), FlowHandlerAdapter (Webflow HandlerAdapter), JsfFlowHandlerAdapter (Webflow + JSF HandlerAdapter)

    The CacheControl seconds setting of 0 calls the preventCaching method. So it seems the application is defaulting to a setting of 0.

    org.springframework.web.servlet.support.WebContentGenerator

    protected final void preventCaching(HttpServletResponse response) {
        response.setHeader(HEADER_PRAGMA, "no-cache");
        if (this.useExpiresHeader) {
            // HTTP 1.0 header
            response.setDateHeader(HEADER_EXPIRES, 1L);
        }
        if (this.useCacheControlHeader) {
            // HTTP 1.1 header: "no-cache" is the standard value,
            // "no-store" is necessary to prevent caching on FireFox.
            response.setHeader(HEADER_CACHE_CONTROL, "no-cache");
            if (this.useCacheControlNoStore) {
                response.addHeader(HEADER_CACHE_CONTROL, "no-store");
            }
        }
    }
    

    I found out that since I am using JSF + Webflow, the JsfFlowHandlerAdapter is handling the server requests for the flows/views first. This is why configuring interceptors does not help because the JsfFlowHandlerAdapter has already set the Cache-Control and other HTTP Headers at this point. It turns out I had already extended the JsfFlowHandlerAdapter to handle FlowExecutionRestorationFailureException (see Sping Web Flow Preventing Back Button Use) so all I needed to do was set the configuration I wanted ala WebContentInterceptor (since the configurations belong to the base class WebContentGenerator).

    Custom JsfFlowHandlerAdapter

    public class MyAppFlowHandlerAdapter extends org.springframework.faces.webflow.JsfFlowHandlerAdapter {
         ...
        }
    

    webmvc-config.xml

    <!-- Dispatches requests mapped to flows to FlowHandler implementations -->
        <bean
            class="com.myapp.MyAppFlowHandlerAdapter">
            <property name="flowExecutor" ref="flowExecutor" />
                <!-- Disable built in Cache-Control settings -->
            <property name="cacheSeconds" value="-1" />
            <property name="useExpiresHeader" value="false" />
            <property name="useCacheControlHeader" value="false" />
            <property name="useCacheControlNoStore" value="false" />
        </bean>
    
    <!-- Maps request paths to flows in the flowRegistry; e.g. a path of /hotels/booking 
        looks for a flow with id "hotels/booking" -->
    <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
        <!-- snip out unimportant -->
        <property name="interceptors">
            <list>
                <ref bean="cacheControlInterceptor" />  
            </list>
        </property>
    </bean>
        <bean id="cacheControlInterceptor"
        class="com.myapp.CacheControlInterceptor">
    

    CacheControlInterceptor (to set your own HTTP Headers. The methods that do it in WebContentGenerator are final so cannot @Override)

    public class CacheControlInterceptor extends HandlerInterceptorAdapter {
    
        @Override
        public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
                //Example below: set your Cache-Control, expires, pragma headers here
            response.setHeader("Cache-Control", "private");
    
            return true;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that uses WPF Composite, and I have an issue. I've
I ran across an interesting issue today. We have an application that utilizes Zend
We currently have an application that is roughly 22 megs total. Our current deployment
I have a reference application that I use to work through DDD issues, and
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue that (I think) might have to do with scope, but
I have an issue that is driving me nuts and hoping someone can help.
I have an issue that seems like very flaky behavour, is this a problem
I have an issue that looks like a race condition with a webview callback
I have an issue that when I leave the android device idle for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.