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

  • SEARCH
  • Home
  • 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 8383201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:06:27+00:00 2026-06-09T17:06:27+00:00

How can I define my content of a page cacheable? I am using Google

  • 0

How can I define my content of a page cacheable? I am using Google Chromes Audit function and it tells me:

The following resources are explicitly non-cacheable. Consider making them cacheable if possible.

I created a new Filter that is called with every request:

public class CachingFilter implements Filter {

    public void init(FilterConfig filterConfig) {
    }

    public void destroy() {
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

    HttpServletResponse httpResponse = (HttpServletResponse) response;

        httpResponse.setHeader("Cache-Control", "private");
        httpResponse.setDateHeader("Expires", System.currentTimeMillis() + 604800000L); // one week
        httpResponse.setDateHeader("Max-Age", System.currentTimeMillis() + 604800000L);

        chain.doFilter(request, response);
    }
}

This Filter works for all JavaScript files, because they don’t appear in the Google Audit tool anymore. But I still get a list of images and the main JSP file. What other headers do I have to set to also enable caching for them?

This is the Request-Header of an image:

Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:entries=20; JSESSIONID=fSSOjMOknqW4yk0bH1Nxy2Ea.undefined
Host:localhost:8080
If-Modified-Since:Mon, 13 Aug 2012 12:52:32 GMT
If-None-Match:W/"1685-1344862352945"
Referer:http://localhost:8080/SSIS2_JBoss7/View/PackageManagement/Packages.jsp
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.79 Safari/537.1

And the Response-Header of the image:

Cache-Control:private
Date:Thu, 16 Aug 2012 08:33:05 GMT
ETag:W/"1685-1344862352945"
Expires:Thu, 23 Aug 2012 08:33:05 GMT
Max-Age:Thu, 23 Aug 2012 08:33:05 GMT
Pragma:No-cache
  • 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-09T17:06:28+00:00Added an answer on June 9, 2026 at 5:06 pm

    I had to add this line in order to cache all images and the main JSP file:

    httpResponse.setHeader("Pragma", "private");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following html page: <html> <head> <title>AJAX Example</title> <meta http-equiv=Content-Type content=text/html;
How can i define that the content of the emailaddress-element has to be unquie
I can define church numerals fairly easy using scheme: > (define f (lambda (x)
I'm using a file, page.php, as an HTML container for several content files; i.e.,
I have noticed that, from Google Maps page, you can get an embed link
I am using ckeditor in phpbb. when adding content in my post page. I
I have a number of non-page content items that are used as callouts on
I have the following on my main jsf wrapper page: <head> <meta http-equiv=Content-Type content=text/xhtml;
I can define default value in domain by this way : class ProcessingPriority {
I know I can define default parameters in python, but can I do so

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.