users@jersey.java.net

Re: [Jersey] disabling IE cache on the HTTP response

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 20 May 2008 12:59:38 -0400

FYI,

In GlassFish we are adding the following to escape the problem:

> if (securePagesWithPragma) {
> // FIXME: These cause problems with downloading office docs
> // from IE under SSL and may not be needed for newer Mozilla
> // clients.
> sresponse.setHeader("Pragma", "No-cache");
> sresponse.setHeader("Cache-Control", "no-cache");
> } else {
> sresponse.setHeader("Cache-Control", "private");
> }
> sresponse.setHeader("Expires", DATE_ONE);

I suspect adding the Pragma header will fix IE. Just a wild guess....

-- Jeanfrancois



Arul Dhesiaseelan wrote:
> Thanks Paul for your great help.
>
> I know IE compatibility is painful.
>
> Cheers,
> Arul
>
> Paul Sandoz wrote:
>> Arul Dhesiaseelan wrote:
>>> Paul,
>>>
>>> I still face the caching issue with IE. If I set "Every time I visit
>>> the webpage" in the IE settings, it works. Not sure why it does not
>>> work when it is set "Automatically".
>>>
>>
>> I know next to nothing about IE, so i cannot help you, sorry :-(
>>
>>
>>>
>>>
>>> Here is the request sent by IE in my other case.
>>>
>>> POST /rest/rows/delete HTTP/1.1
>>> x-requested-with: XMLHttpRequest
>>> Accept-Language: en-us
>>> Referer: http://localhost:9080/rows.html
>>> Accept: */*
>>> Content-Type: application/x-www-form-urlencoded, application/json
>>
>> That is an invalid content type! as it contains two media types,
>> instead of just one. It should be just:
>>
>> Content-Type: application/json
>>
>> Paul.
>>
>>> UA-CPU: x86
>>> Accept-Encoding: gzip, deflate
>>> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
>>> CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR
>>> 3.0.04506.648)
>>> Host: 127.0.0.1:9080
>>> Content-Length: 24
>>> Connection: Keep-Alive
>>> Cache-Control: no-cache
>>>
>>> {"rows":[{"id":"1"}]}
>>>
>>>
>>> Thanks!
>>> Arul
>>>
>>> Paul Sandoz wrote:
>>>> Arul Dhesiaseelan wrote:
>>>>> --response from TCPMonitor--
>>>>>
>>>>> HTTP/1.1 200 OK
>>>>> Content-Type: application/xml
>>>>> Expires: Mon, 26 Jul 1997 05:00:00 GMT
>>>>> Content-Length: 953
>>>>> Server: Jetty(6.1.9)
>>>>>
>>>>> Do you know what is happening here?
>>>>>
>>>>
>>>> According to my calendar the 26th of July 1997 is not a Monday, it
>>>> is a Saturday. Perhaps IE is rejecting this as an invalid header
>>>> whereas Firefox is more forgiving?
>>>>
>>>>
>>>>> I observed another browser related issue when I delete a resource.
>>>>> It works just fine in FireFox. But, in IE I see the following
>>>>> exception,
>>>>>
>>>>
>>>> Can you log and email the request headers that are being sent by IE?
>>>>
>>>> Thanks,
>>>> Paul.
>>>>
>>>>> 2008-05-16 16:36:34.732::WARN: /rest/rows/delete
>>>>> java.lang.IllegalArgumentException: java.text.ParseException:
>>>>> Expected separator
>>>>> ';' instead of ','
>>>>> at
>>>>> com.sun.ws.rest.impl.provider.header.MediaTypeProvider.fromString(Med
>>>>> iaTypeProvider.java:78)
>>>>> at
>>>>> com.sun.ws.rest.impl.provider.header.MediaTypeProvider.fromString(Med
>>>>> iaTypeProvider.java:37)
>>>>> at javax.ws.rs.core.MediaType.parse(MediaType.java:108)
>>>>> at
>>>>> com.sun.ws.rest.impl.model.HttpHelper.getContentType(HttpHelper.java:
>>>>> 63)
>>>>> at
>>>>> com.sun.ws.rest.impl.model.HttpHelper.getContentType(HttpHelper.java:
>>>>> 52)
>>>>> at
>>>>> com.sun.ws.rest.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.j
>>>>> ava:89)
>>>>> at
>>>>> com.sun.ws.rest.impl.uri.rules.RightHandPathRule.accept(RightHandPath
>>>>> Rule.java:96)
>>>>> at
>>>>> com.sun.ws.rest.impl.uri.rules.ResourceClassRule.accept(ResourceClass
>>>>> Rule.java:56)
>>>>> at
>>>>> com.sun.ws.rest.impl.uri.rules.RightHandPathRule.accept(RightHandPath
>>>>> Rule.java:96)
>>>>> at
>>>>> com.sun.ws.rest.impl.uri.rules.RootResourceClassesRule.accept(RootRes
>>>>> ourceClassesRule.java:49)
>>>>> at
>>>>> com.sun.ws.rest.impl.application.WebApplicationImpl.handleRequest(Web
>>>>> ApplicationImpl.java:416)
>>>>> at
>>>>> com.sun.ws.rest.spi.container.servlet.ServletContainer.service(Servle
>>>>> tContainer.java:151)
>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>>> at
>>>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487
>>>>> )
>>>>> at
>>>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
>>>>> 62)
>>>>> at
>>>>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
>>>>> a:216)
>>>>> at
>>>>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
>>>>> 81)
>>>>> at
>>>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7
>>>>> 26)
>>>>> at
>>>>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>>>>>
>>>>> at
>>>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHand
>>>>> lerCollection.java:206)
>>>>> at
>>>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.
>>>>> java:114)
>>>>> at
>>>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
>>>>> 52)
>>>>> at org.mortbay.jetty.Server.handle(Server.java:324)
>>>>> at
>>>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:50
>>>>> 5)
>>>>> at
>>>>> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnectio
>>>>> n.java:842)
>>>>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
>>>>> at
>>>>> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
>>>>> at
>>>>> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>>>> at
>>>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.ja
>>>>> va:395)
>>>>> at
>>>>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool
>>>>> .java:450)
>>>>> Caused by: java.text.ParseException: Expected separator ';' instead
>>>>> of ','
>>>>> at
>>>>> com.sun.ws.rest.impl.http.header.reader.HttpHeaderReader.nextSeparato
>>>>> r(HttpHeaderReader.java:85)
>>>>> at
>>>>> com.sun.ws.rest.impl.http.header.reader.HttpHeaderReader.readParamete
>>>>> rs(HttpHeaderReader.java:213)
>>>>> at
>>>>> com.sun.ws.rest.impl.provider.header.MediaTypeProvider.fromString(Med
>>>>> iaTypeProvider.java:74)
>>>>> ... 29 more
>>>>>
>>>>> Thanks!
>>>>> Arul
>>>>>
>>>
>>
>
>