|
|
Get page header information using jsp - JSP/Java
|
Views : 792
|
|
Tagged in : JSP-Java
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
|
< %@ page import="java.util.Enumeration" % >
< h2 > Page Header Information < /h2 >
< table border=1 >
<%
Enumeration eNames = request.getHeaderNames();
while (eNames.hasMoreElements()) {
String name = (String) eNames.nextElement();
String value = normalize(request.getHeader(name));
//String value = request.getHeader(name);
%>
< tr > < td > < %=name% > < /td > < td > <%=value% > </ td > < /tr > <%}% >
< /table >
<%!
private String normalize(String value)
{
StringBuffer sb = new StringBuffer();
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
sb.append(c);
if (c == ';')
sb.append(" ");
}
return sb.toString();
}
%>
HTTP Request Headers Received
| host | localhost:8181 |
| user-agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 |
| accept | text/html,application/xhtml+xml,application/xml; q=0.9,*/*; q=0.8 |
| accept-language | en-us,en; q=0.5 |
| accept-encoding | gzip,deflate |
| accept-charset | ISO-8859-1,utf-8; q=0.7,*; q=0.7 |
| keep-alive | 300 |
| connection | keep-alive |
| cookie | JSESSIONID=992EA52BA3CC3723D5DC07C0FCB87A1A |
| cache-control | max-age=0 |
|
|
By Vinoth, On - 2009-07-18 |
|
|
|