You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "David M. Rosner" <da...@recommend-it.com> on 2001/04/17 21:10:04 UTC
HTTP Referer Field Not Appearing
Hi All,
For some reason I can't get the Referer header field from any of my JSP
pages. I'm using the following code:
String strReferringURL = request.getHeader( "referer" ) ;
I also tried looking at all of the headers in the request, but it doesn't
look like this is including all of the headers:
for (Enumeration e = request.getHeaderNames() ; e.hasMoreElements() ;) {
Log.getInstance().logError( (String) e.nextElement() );
}
Is this because my browser is not sending all of the fields (including
referrer), or could it be the way that I have Tomcat configured?
Thanks!
-dave
Re: HTTP Referer Field Not Appearing
Posted by Jeff Kilbride <je...@kilbride.com>.
Could be the capitalization. I use:
String referer = req.getHeader("Referer");
and it works with jdk1.3 and Tomcat 3.2.1.
Thanks,
--jeff
----- Original Message -----
From: "David M. Rosner" <da...@recommend-it.com>
To: <to...@jakarta.apache.org>
Sent: Tuesday, April 17, 2001 12:10 PM
Subject: HTTP Referer Field Not Appearing
> Hi All,
>
> For some reason I can't get the Referer header field from any of my JSP
> pages. I'm using the following code:
>
> String strReferringURL = request.getHeader( "referer" ) ;
>
> I also tried looking at all of the headers in the request, but it doesn't
> look like this is including all of the headers:
>
> for (Enumeration e = request.getHeaderNames() ; e.hasMoreElements() ;) {
> Log.getInstance().logError( (String) e.nextElement() );
> }
>
>
> Is this because my browser is not sending all of the fields (including
> referrer), or could it be the way that I have Tomcat configured?
>
> Thanks!
>
> -dave
>
RE: HTTP Referer Field Not Appearing
Posted by CPC Livelink Admin <cp...@fitzpatrick.cc>.
On 3.2.1 it works for me. Make sure you are actually getting to the page
using a method which would generate a referrer. Just typing the link in the
browser address bar will not do it. You need to make a dummy html file with
a link to your test page and click on the link to see it.
-----Original Message-----
From: David M. Rosner [mailto:dave@recommend-it.com]
Sent: Tuesday, April 17, 2001 3:10 PM
To: tomcat-user@jakarta.apache.org
Subject: HTTP Referer Field Not Appearing
Hi All,
For some reason I can't get the Referer header field from any of my JSP
pages. I'm using the following code:
String strReferringURL = request.getHeader( "referer" ) ;
I also tried looking at all of the headers in the request, but it doesn't
look like this is including all of the headers:
for (Enumeration e = request.getHeaderNames() ; e.hasMoreElements() ;) {
Log.getInstance().logError( (String) e.nextElement() );
}
Is this because my browser is not sending all of the fields (including
referrer), or could it be the way that I have Tomcat configured?
Thanks!
-dave
Re: HTTP Referer Field Not Appearing
Posted by Milt Epstein <me...@uiuc.edu>.
On Tue, 17 Apr 2001, David M. Rosner wrote:
> Hi All,
>
> For some reason I can't get the Referer header field from any of my JSP
> pages. I'm using the following code:
>
> String strReferringURL = request.getHeader( "referer" ) ;
Is that the only named you tried? Capitalization and/or the exact
spelling/name might make a difference. For example, try "Referer".
You might also check the archives to see what people have to say about
it.
> I also tried looking at all of the headers in the request, but it doesn't
> look like this is including all of the headers:
>
> for (Enumeration e = request.getHeaderNames() ; e.hasMoreElements() ;) {
> Log.getInstance().logError( (String) e.nextElement() );
> }
>
> Is this because my browser is not sending all of the fields (including
> referrer), or could it be the way that I have Tomcat configured?
A long long time ago in a galaxy far far away (i.e. a different
servlet engine/container) I ran into the situation that getHeaderNames
only returned a hard-coded set of headers, not all headers actually in
the request (so I could getHeader a header that wasn't shown in
getHeaderNames) -- this was something that had to be done because of
the way this information was transferred from the web server to the
servlet engine/container. I don't know if this is still the case.
But try alternatives for "referer" (and/or check the archives), and
see if that helps.
Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
mepstein@uiuc.edu