Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 18405 invoked from network); 9 Feb 2006 04:58:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Feb 2006 04:58:09 -0000 Received: (qmail 2906 invoked by uid 500); 9 Feb 2006 04:57:54 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 2886 invoked by uid 500); 9 Feb 2006 04:57:53 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 2875 invoked by uid 99); 9 Feb 2006 04:57:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2006 20:57:53 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of anoopkumarv@gmail.com designates 64.233.184.194 as permitted sender) Received: from [64.233.184.194] (HELO wproxy.gmail.com) (64.233.184.194) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2006 20:57:52 -0800 Received: by wproxy.gmail.com with SMTP id i22so28434wra for ; Wed, 08 Feb 2006 20:57:31 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=FBgtw3gs7XvXYHYg/ViZ8uUp7ek430kQuZ/IIlXNWYeSRwg97HMPQmowjT5kiImz7jZV/B2z6acKLfDF7A9nb6kH9B3oiotDKCZnYyinwDqfOah1R+I1SiidVzlVmVYThlRW9kWfjwb42K5UW5dRDK/OHT2v+0dSg2UMbZh7/Sc= Received: by 10.54.126.12 with SMTP id y12mr9832748wrc; Wed, 08 Feb 2006 20:57:31 -0800 (PST) Received: by 10.54.84.16 with HTTP; Wed, 8 Feb 2006 20:57:31 -0800 (PST) Message-ID: Date: Wed, 8 Feb 2006 23:57:31 -0500 From: Anoop kumar V To: Tomcat Users List , dns4@cornell.edu, yuemu888@yahoo.com Subject: Re: request.getHeader() gives null In-Reply-To: <43E60E32.2040807@cornell.edu> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3939_20915747.1139461051322" References: <20060205052410.2879.qmail@web35913.mail.mud.yahoo.com> <43E60E32.2040807@cornell.edu> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_3939_20915747.1139461051322 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks a lot to both David Smith and Yue Mu - I am exploring other options of setting values. Also someone else has suggested that I use POST from a form - i willl try that too - thanks a ton, Anoop Kumar V. On 2/5/06, David Smith wrote: > > Anoop -- > > Correct me if I'm wrong, but it looks like you are trying to set > response headers on a 302 response and then expecting those headers to > return on the next request. I can't find any information indicating > this behavior is supported by the HTTP protocol. You are better off > setting cookies, GET parameters, or session attributes to transfer info > the the next request. The first two will work for any request to the > same server. The last one will only work if the next request is going > to the same webapp. > > --David > > Yue Mu wrote: > > HI Anoop, > > > > >> Is it that the response of the first page becomes the request of > the next jsp.... > > > > No - "the next jsp" gets the same request, which is the whole idea of > "forwarding" a request. This is why you don't see the newly added headers > (to the response!). > > > > I'm not sure what you are trying to do but you need to use > Response.containHeaders(java.lang.String name) to check if a header is > already there. > > > > Hope this helps. > > > > Regards, > > Z. > > > > Anoop kumar V wrote: > > I would really appreciate if someone can answer my question.. > > > > Thanks, > > Anoop > > > > On 2/3/06, Anoop kumar V wrote: > > > >> HI All, > >> > >> I am using Tomcat5. > >> I have a simple jsp displaying the header information that I have set > in > >> another jsp page. For some reason I can see all the default headers > except > >> the headers that I have set in this jsp. I am doing a jsp:forward to g= o > to > >> the next page which displays the header information ( I have also trie= d > >> redirect - but just wont work)... > >> > >> > >> > -------------------------------------------------------------------------= ----------------------------------- > >> ------------------------------------------ > >> index.jsp---------------------------------------------------- > >> > >> > -------------------------------------------------------------------------= ----------------------------------- > >> > >> > >> > >>> @author Anoop Kumar V. > >>> > >> Date: Jan 19, 2006 4:13:05 PM > >> --%> > >> > >> > >> > >> > >> > >> > >> > >> > > > > > >>> System.out.println("Jsp called successfully"); > >>> > >> response.addHeader("userName","GSE_FMS"); > >> response.setHeader("userName","GSE_FMS"); //just to be sure....= . > >> response.addHeader("myValue","theValue"); > >> > >> boolean isheader =3D response.containsHeader("userName"); > >> > >> System.out.println("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\ncontains > >> userName header ..."+isheader); > >> System.out.println("contains myValue header ..." + > >> response.containsHeader("myValue")); > >> //response.sendRedirect("/TestHeaderResponse.jsp"); > >> > >> %> > >> > >> > >> > >> > >> > -------------------------------------------------------------------------= ----------------------------------- > >> -------------------------- > >> TestHeaderResponse.jsp---------------------------------------------- > >> > >> > -------------------------------------------------------------------------= ----------------------------------- > >> > >> > >>> Created for Sikorsky GSE > >>> > >> @author Anoop Kumar V. > >> Date: Jan 19, 2006 4:13:05 PM > >> --%> > >> > >> > >> > >> > >> > >> > >> > > > > > >>> System.out.println("Test header response page called > successfully"); > >>> > >> String s =3D request.getHeader("userName"); > >> System.out.println("user: "+s); // Issue: always > returns > >> null even though set in the previous page > >> out.println("USERNAME HEADER: " + s +" > >> > > "); > > > >> Enumeration headernames =3D request.getHeaderNames(); > >> System.out.println("Headers---------"); > >> while (headernames.hasMoreElements()){ > >> String headername =3D (String)headernames.nextElement(); > >> String headervalue =3D request.getHeader(headername); > >> System.out.println(headername+"----"+headervalue); > >> out.println(" " + headername+"----"+headervalue + " > >> > > "); > > > >> out.flush(); > >> } > >> %> > >> > >> > >> > >> > -------------------------------------------------------------------------= ----------------------------------- > >> > >> I think I am doing something fundamentally wrong.... > >> > >> Also can someone help me with understanding how the setHeader and > >> getHeader works - we use response.setHeader to set but use > >> request.getHeader to read the header values. Is it that the response o= f > >> the first page becomes the request of the next jsp.... > >> -- > >> Thanks and best regards, > >> Anoop > >> > >> > >> > > > > > > -- > > Thanks and best regards, > > Anoop > > > > > > > > --------------------------------- > > Relax. Yahoo! Mail virus scanning helps detect nasty viruses! > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > -- Thanks and best regards, Anoop ------=_Part_3939_20915747.1139461051322--