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 1012975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:01:38+00:00 2026-05-16T10:01:38+00:00

I have a js file which is cached between 5-10 minutes, depending on whether

  • 0

I have a js file which is cached between 5-10 minutes, depending on whether I’m using tomcat from the eclipse (via GWT plugin) or starting tomcat as standalone.
This is strange as I’m using GWT as my framework and this file should not be cached at all (it’s a nocache.js file to those of you who know GWT).
I’ve read on a GWT Google group thread that it’s a container configuration issue, and somewhere else that it’s something I need to define in the containing HTML file.
Basically, I’m confused right now as I have no clue on how to get this file to not cache.
Please note that this js is generated by GWT and I cannot modify it.

Thanks for any help,
Ittai
alt text
alt text

  • 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-05-16T10:01:38+00:00Added an answer on May 16, 2026 at 10:01 am

    Using a javax.servlet.Filter

    One way to do this in a portable way (across different app servers), is using Filters. In your web.xml add the following:

      <filter>
        <filter-name>headersFilter</filter-name>
        <filter-class>MyHeadersFilter</filter-class>
      </filter>
      <filter-mapping>
        <filter-name>headersFilter</filter-name>
        <url-pattern>/*</url-pattern>
      </filter-mapping>
    

    Then implement your MyHeadersFilter like:

    public class MyHeadersFilter implements Filter {
    
      @Override
      public void doFilter(final ServletRequest request,
             final ServletResponse response, final FilterChain chain)
             throws IOException, ServletException {
    
          final HttpServletRequest httpRequest = (HttpServletRequest) request;
          final String requestUri = httpRequest.getRequestURI();
    
          final HttpServletResponse httpResponse = (HttpServletResponse) response;
    
    
          if (requestUri.contains(".nocache.")) {
            httpResponse.addHeader("Cache-Control", "no-cache");
            ...
    
          } else if (...) {
            ...
          }
    
          chain.doFilter(request, response);
      }
    }
    

    Optional: Configurable Filters

    You can also make your filter configurable from your web.xml, by using <init-param>s:

      <filter>
        <filter-name>headersFilter</filter-name>
        <filter-class>MyHeadersFilter</filter-class>
        <init-param>
            <param-name>myParam</param-name>
            <param-value>myValue</param-value>
        </init-param>
      </filter>
    

    Add the following to MyHeadersFilter:

        private FilterConfig filterConfig;
    
        @Override
        public void init(final FilterConfig filterConfig) throws ServletException {
            this.filterConfig = filterConfig;
        }
    
        @Override
        public void destroy() {
            this.filterConfig = null;
        }
    

    That makes it possible to access your init-param(s) using:

    filterConfig.getInitParameter("myParam")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php file which I will be using as exclusively as an
I have a file which is an XML representation of some data that is
I have an excel file which has more than 65536 rows. However, I can
I have a .rc file which is used to include some text data in
i have a log file which contains hundreds/thousands of seperate XML messages and need
I have a txt file which actually is a html source of some webpage.
I have a javascript file that reads another file which may contain javascript fragments
Good morning. I have an XML file which contains lists of warning and errors
Here's what I'm trying to do, and failing... I have a File model which
I have a Nant build file which executes NUnit after compiling the dll's. I

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.