javax.servlet.http.HttpServletResponse.sendError() nullyfies any addHeader()

  • Thread starter Joerg Mueller-Tolk
  • Start date
J

Joerg Mueller-Tolk

My question is about javax.servlet.http.HttpServletResponse

The "setStatus(int, String)" is deprecated and "sendError(int,
String)" should be used instead.
But if I do so any calls to "response.addHeader(String, String)" have
no effect.

Is there a way without deprecated methods to have both:
- private header tags, and
- private status string?

Any hints welcome
joerg M-T
 
A

Andy Fish

I am using tomcat 4.1 and I use response.setHeader(); and
response.sendError(); with no problems

note that you must do the setHeader before the sendError
 
J

Joerg Mueller-Tolk

Andy Fish said:
I am using tomcat 4.1 and I use response.setHeader(); and
response.sendError(); with no problems

note that you must do the setHeader before the sendError

excellent!
It was just a question of call order.

thx
Joerg M-T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top