Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How to overwrite HTTP HEADER in a servlet

  Asked By: Bakir    Date: Dec 28    Category: Java    Views: 1277
  

I have a servlet which streams out to show doc or ppt in a browser .How can i force the browser to show it without that prompt every time asks user what to do( open or save)
I set my header this way


response.setHeader("Content-Type" , "application/msword; name=" + fileName
response.setHeader("Content-Length" , new Long(lenght).toString() );
response.setHeader("Content-Transfer-Encoding","7bit");

response.setHeader("Content-Disposition" , "inline; filename=" + fileName +)

but it doesnt work
Does anybody have any idea?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Aaliyah Khan     Answered On: Dec 28

usually the problem occures when you touch the response  before setting the header. I mean you got to do this settings before ANY change in the response or the API will ignore it.

 
Didn't find what you were looking for? Find more on How to overwrite HTTP HEADER in a servlet Or get search suggestion and latest updates.




Tagged: