java - Servlet response should be cached but isn't -


I am trying to cache servlet feedback, but in some way it is not working (firebug me 200 releases I'm doing the page). The code I added to this subnet:

  response.setContentType ("Application / JavaScript"); Long time = System.currentTimeMillis (); Response.setCharacterEncoding ("UTF-8"); Response.setDateHeader ("Last-Modified", 0); Response.addHeader ("Cash-Control", "Max-Age = 5184000"); Response.setDateHeader ("End", now + 5184000 * 1000); Response.addHeader ("different", "host");   

I have also tried with setHeader and last-modified , now.

Nothing seems to work. Any ideas?

Thank you

This way Firebug shows me the response / request header (when the resource should be taken from the cache, but not):

  Response HeadersViews Source Cache-Control Max-Age = 5184000 Connection-Live Content-Type Application / Javascript; Charset = UTF-8 Date gurus, 21 March 2013 09:53:48 GMT Sun expiry, 31 March 2013 16: 51:01 GMT Elite timeout = 15, Max = 99 HeadersVisue Request Request * / * Accept- Encoding gzip, display acceptance-language n-US, n; Q = 0.5 cache-control max-age = 0   

last-modified < Using / code> requires cooperative coding in your servlet when you send it to a customer, then the client will be sent back, when the same resource is requested, one of the possible sets of headers :

  • If- Modified-Since:
  • If- Unfamiliar- to:

    Take action on these headings Security will, to determine whether material or given since been changed or not date and then 304 response was not this case. Many of the manual work also keep in mind that should be last modified date (example: Tuesday, 15 November, 1994 12:45:26 GMT ).

    The easiest way for you to ignore the route last-modified for now and instead of cache-control and end < Use the / code> header. Your ending header needs to be in a valid date format, as described for the last modified header.

    You can read more on caching, inside, inside

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -