Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Reading Request Information
Reading Request Information Reading Request Information When an HTTP client such as web browser sends a request to a wen server, along with the request it also sends some HTTP variables like Remote address, Remote host, Content type etc. In some
 
Search Tutorials:
 
Software Solutions and Services
 

 
Google Custom Search:
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation

Reading Request Information

                          

When an HTTP client such as web browser sends a request to a wen server, along with the request it also sends some HTTP variables like Remote address, Remote host, Content type etc. In some cases these variables are useful to the programmers. So here is the code of the jsp file which prints the HTTP request information:

 

 

 

 

 

<%@page contentType="text/html" import="java.util.*" %>

<!--

http://www.roseindia.net/jsp

-->

<html>

<body>

<p><font size="5" color="#800000">Request Information:</font></p>

<div align="left">

<table border="0" cellpadding="0" cellspacing="0" width="70%" bgcolor="#EEFFCA">

<tr>

<td width="33%"><b><font color="#800000">Request Method:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getMethod()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Request URI:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getRequestURI()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Request Protocol:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getProtocol()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Path Info:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getPathInfo()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Path translated:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getPathTranslated()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Query String:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getQueryString()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Content length:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getContentLength()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Content type:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getContentType()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Server name:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getServerName()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Server port:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getServerPort()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Remote user:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getRemoteUser()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Remote address:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getRemoteAddr()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Remote host:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getRemoteHost()%></font></td>

</tr>

<tr>

<td width="33%"><b><font color="#800000">Authorization scheme:</font></b></td>

<td width="67%"><font color="#FF0000"><%=request.getAuthType()%></font></td>

</tr>

</table>

</div>

</body>

</html>

 

Execute the example.

Download the  code

                          

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

13 comments so far (
post your own) View All Comments Latest 10 Comments:

how to link one file to another

Posted by nithi on Thursday, 12.18.08 @ 22:14pm | #82943

I have found few spell mistakes in the entire pages. Please take care as it is read by thousands and thousands of people.

Posted by Gunnu on Monday, 11.17.08 @ 01:00am | #81734

Sir,

This is Gopi. I visited your site and i cleanly go through the articles about JSP. But when i try to execute the code it is not going to execute that what you gave in the site.So please give me suggestions how to execute that code.

Posted by Gopikrishna on Monday, 10.13.08 @ 15:27pm | #81043

Hi,
Can you tell me how to compile and execute a jsp page,..!
I have clear view of running servlets,...!

Posted by sairaj on Sunday, 10.5.08 @ 21:21pm | #80913

Thanks a lot! Splendid tutorial!

Posted by Paul on Wednesday, 09.17.08 @ 23:26pm | #80147

hi,
i am pavani,u explained me in a very nice and precise way,that helped me most.
thanks and regards
pavan,
trainee. Software Engineer

Posted by pavan on Wednesday, 02.13.08 @ 18:13pm | #48160

i m not able to exucute the progam.please tell me the procejure to execute it on my comp.

Posted by rahul on Tuesday, 01.15.08 @ 01:21am | #45207

hi,
i am ravi,u explained me in a very nice and precise way,that helped me mot.
thanks and regards
ravi,
trainee. Software Engineer
Etech services private ltd
gudgaon

Posted by ravi on Friday, 01.11.08 @ 16:34pm | #44979

YAA ITS REALLY USEFUL TO EVERY ONE.
ITS VERY NICE TO READ AND EASY WAY ALSO.

Posted by VISHNU on Friday, 11.16.07 @ 17:46pm | #37568

This jsp related tutorial is very nice .but give information about directives and standared action which one is useful to include code and which one is for viewing purpuse.

Posted by swarali dubey on Friday, 08.24.07 @ 13:57pm | #24032

Training Courses
Tell A Friend
Your Friend Name
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.