Howdy,
Why do this in a valve (tomcat-specific) when you can do it in a Filter in a
container-independent way?
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
if(req instanceof HttpServletRequest) {
HttpServletRequest hreq = (HttpServletRequest) req;
hreq.addHeader("test-id", "test-value");
}
chain.doFilter(req, res);
}
That's all you would have to do.
Yoav Shapira
Millennium ChemInformatics
>-----Original Message-----
>From: Oliver Wulff [mailto:[EMAIL PROTECTED]
>Sent: Friday, June 13, 2003 10:18 AM
>To: [EMAIL PROTECTED]
>Subject: Valve, set/get http header attributes
>
>
>
>
>
>How can I read and write http header attributes in a valve. I tried the
>following inside a valve which does return false in the second call:
>
>import org.apache.catalina.HttpRequest;
>import javax.servlet.http.HttpServletRequest;
>
>...
>
>public void invoke(Request request, Response response, ValveContext
>context)
> throws IOException, ServletException
>{
>
> ((HttpRequest)request).addHeader("test-id", "test-value");
> ((HttpServletRequest)request).getHeader("test-id");
>...
>}
>
>
>
>
>
>
>******************* BITTE BEACHTEN *******************
>Diese Nachricht (wie auch allf�llige Anh�nge dazu) beinhaltet
>m�glicherweise vertrauliche oder gesetzlich gesch�tzte Daten oder
>Informationen. Zum Empfang derselben ist (sind) ausschliesslich die
>genannte(n) Person(en) bestimmt. Falls Sie diese Nachricht
>irrt�mlicherweise erreicht hat, sind Sie h�flich gebeten, diese unter
>Ausschluss jeder Reproduktion zu zerst�ren und die absendende Person
>umgehend zu benachrichtigen. Vielen Dank f�r Ihre Hilfe.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged. This
e-mail is intended only for the individual(s) to whom it is addressed, and may not be
saved, copied, printed, disclosed or used by anyone else. If you are not the(an)
intended recipient, please immediately delete this e-mail from your computer system
and notify the sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]