aspose file tools*
The moose likes Websphere and the fly likes setting header in websphere 8. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "setting header in websphere 8." Watch "setting header in websphere 8." New topic
Author

setting header in websphere 8.

pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 410

Hi All,

I am sure this problem is very common. I have excel export functionality on my application. I am using Websphere. The export doesn't work on IE8 when on SSL. I searched on internet. I found that WAS sets a header "Cache-Control: no-cache". So because of this IE8 won't allow you to download the excel file. I saw some solutions where people say set header in some servlet filter. But it doesn't work. Then I saw one solution which says as below:

“We finally figured out a hack-ish (but simple) fix to the “no-cache” header
problem…

We found that each instance of a response.addCookie() call causes the
“no-cache…” to be added to the Cache-Control header. So if we just set the
Cache-Control header after all the cookie processing was complete, the
header would then be passed unmolested to the client.

A silly solution to a silly, undocumented problem (feature).”


Looks pretty simple. But I am not sure how do I know that cookie processing is completed? Can any one help me on that?


Pawan Chopra
SCJP - DuMmIeS mInD
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

That quote is from the IBM forums. (It's good to cite information so people can read the surrounding context.)

In fact, it says later in that same thread

Indeed, I applied the fix with the CookiesConfigureNoCache=false as specified in the below link and it solved my problem.

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/rrun_chain_httpcustom.html


That seems better to try than hacking at addCookies().


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Phani Kiran Rudravarapu
Greenhorn

Joined: Jul 31, 2012
Posts: 3

Hi,

We are facing something similar issue. We need to give a progress bar for file downloads and we are thinking of using jquery.download.js
This involves setting response's header with a cookie. When we tested this on our local machine with Tomcat it works fine.
But when we put it on Websphere it doesn't.

We can't try CookiesConfigureNoCache=false setting as getting admin access and modifying this property might be a bureaucratic nightmare.

In the link shared in above posts, i couldn't get what exactly this means "So if we just set the Cache-Control header after all the cookie processing was complete, the header would then be passed unmolested to the client".

Our code to provide an excel file as save-as is pretty simple like below. What should i change in the below to make the cookie setting work in WebSphere?



[OCJP6 -91%] , EJB Novice
pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 410

Phani Kiran Rudravarapu wrote:Hi,

We are facing something similar issue. We need to give a progress bar for file downloads and we are thinking of using jquery.download.js
This involves setting response's header with a cookie. When we tested this on our local machine with Tomcat it works fine.
But when we put it on Websphere it doesn't.

We can't try CookiesConfigureNoCache=false setting as getting admin access and modifying this property might be a bureaucratic nightmare.

In the link shared in above posts, i couldn't get what exactly this means "So if we just set the Cache-Control header after all the cookie processing was complete, the header would then be passed unmolested to the client".

Our code to provide an excel file as save-as is pretty simple like below. What should i change in the below to make the cookie setting work in WebSphere?



I don't remember exactly but I know I changed between Content-Disposition values I think I tried inline and it worked. You can give it a try.
Phani Kiran Rudravarapu
Greenhorn

Joined: Jul 31, 2012
Posts: 3

Thanks for your immediate reply. I tried using 'inline' instead of attachment and still same issue.
The file download works fine in Firefox but in IE i get a HTTP 500 Internal Server error.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: setting header in websphere 8.