Of course, you could just call request.getRemoteAddr();
Tomcat is a Servlet Specification container. You don't get headers with
CGI naming conventions.
Check out the api documentation:
http://java.sun.com/j2ee/1.4/docs/api/index.html
It's the packages starting with javax.servlet that will be of most
interest. Specifically, the docs for javax.servlet.ServletRequest give
some info on methods that map to CGI variables.
HTH,
Jon
Jason Bell wrote:
Hi,
When developing web app code I tend to enumerate on the headers coming in.
Have a look at:
public java.util.Enumeration getHeaderNames();
So:
// get the header names
Enumeration ee = request.getHeaderNames();
// then iterate through them
for(;ee.hasMoreElements();){
String header = (String)ee.nextElement();
System.out.println(header + " = " + request.getHeader(header));
}
It's just good to get an overall picture of what is being send in the
headers. As for why the value is null, I don't know 100% but this link may or
may not help.
http://forum.java.sun.com/thread.jspa?threadID=507098&messageID=2404807
getHeader("REMOTE_ADDR");
and getting "null".
I hope this helps in your quest.
Kind regards
Jason
--
Jason Bell
Lead Architect, SpikeSource Europe
e: [EMAIL PROTECTED]
w: http://www.spikesource.com
b: http://jasonbell.blog-city.com
m: +44 (0)787 529 2693
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]