David Fabrizi wrote:
> Writing to the Header?
>
> Scenario:
> From a browser servletA is called, and with-in this servlet the Header
> is manipulate with the following code:
> Enumeration enum = request.getHeaderNames();
> while (enum.hasMoreElements())
> {
> String name = (String) enum.nextElement();
> String value = request.getHeader(name);
> response.setHeader(name,value)
> }
> String str = "000000/AAAAAA";
> response.setHeader("IV_User", str);
>
> Finally the request and response are forwarded use the following code:
>
>
>res.sendRedirect("http://192.168.0.21:2540/servlet/signal.epic.main.client.servletB");
>
This one is not going to work. You are sending back the IV_User header to the browser,
but it's not going to recognize it, so it throws the unknown header away. If you want
to
use sendRedirect, pass your value in a cookie instead.
>
> OR
>
> rd =
> context.getRequestDispatcher("/servlet/signal.epic.main.client.servletB");
>
> rd.forward(request,response);
>
If you want this to work, pass your value as a request attribute instead of a header.
That is, add the following before getting the request dispatcher:
request.setAttribute("IV_User", str);
and in the receiving servlet you can acquire it with:
String ivUser = (String) request.getAttribute("IV_User");
>
> Well every thing compiles and runs fine except that ?IV_User? does not
> exist in Header of the request object of servletB.
>
> Any help would be greatly appreciated.
> Thanks Dave
>
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html