RE: tomcat detecting http header
You can also add this routine within a code block at higher trace levels. This way you can turn on this routine for debugging or logging purposes and don't have to incur additional overheads during runtime. Murugan > 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 > > > > 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] Murugan Pal Founder & CTO Spikesource, Inc. 1400 Seaport Blvd., South Bldg. #350, Redwood City, CA 94063 Phone: 650 241 4006 www.spikesource.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat detecting http header
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]
RE: tomcat detecting http header
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]