Remove response header!


Web tier: servlets, JSP, Web frameworks: Remove response header!

  1. Remove response header! (6 messages)

    Hi all,

    Is it possible to remove an HTTP header from the Servlet response object? i want to remove the Authorization header, but i've found no way to do it, there's just a way to set the header but it's not sufficent.

    Nabil BENMIRA

    Threaded Messages (6)

  2. filter[ Go to top ]

    can you write a Servlet filter class?
  3. filter[ Go to top ]

    No :( i'm working on a servlet specification older than 2.3

    Nabil BENMIRA
  4. filter[ Go to top ]

    Unfortunately, once a header has been added to a response, there is no way to remove it. If you can't use filters, you are going to have to write an interceptor servlet that is functionally equivalent to do the same thing. Pass all request through the interceptor filter, replace the real response with a dummy response that caches output in memory, than process the response results in the interceptor to strip out the necessary header.

    This will be pretty ugly, and may not be worth the trouble.
  5. filter[ Go to top ]

    What application server are you using?
  6. filter[ Go to top ]

    thanx for your responses.

    I'm using Websphere 4
    Servlet Specification Level : 2.2
    Supported JSP Specification Level : 1.1

    Nabil BENMIRA
  7.[ Go to top ]

    Websphere 4.0 has a "filter" package.

    Have you tried it?