|
Jetty example source code file (snoop.jsp)
The Jetty snoop.jsp source code<HTML> <HEAD> <TITLE>JSP snoop page <%@ page import="javax.servlet.http.HttpUtils,java.util.Enumeration" %> </HEAD> <BODY> <H1>WebApp JSP Snoop page <H2>Request information <TABLE> <TR> <TH align=right>Requested URL: <TD><%= HttpUtils.getRequestURL(request) %> |
</TR>
<TR>
<TH align=right>Request method:
<TD><%= request.getMethod() %>
</TR>
<TR>
<TH align=right>Request URI:
<TD><%= request.getRequestURI() %>
</TR>
<TR>
<TH align=right>Request protocol:
<TD><%= request.getProtocol() %>
</TR>
<TR>
<TH align=right>Servlet path:
<TD><%= request.getServletPath() %>
</TR>
<TR>
<TH align=right>Path info:
<TD><%= request.getPathInfo() %>
</TR>
<TR>
<TH align=right>Path translated:
<TD><%= request.getPathTranslated() %>
</TR>
<TR>
<TH align=right>Query string:
<TD><% if(request.getQueryString()!=null) out.write(request.getQueryString().replaceAll("<", "<").replaceAll(">",">")); %>
</TR>
<TR>
<TH align=right>Content length:
<TD><%= request.getContentLength() %>
</TR>
<TR>
<TH align=right>Content type:
<TD><%= request.getContentType() %>
<TR>
<TR>
<TH align=right>Server name:
<TD><%= request.getServerName() %>
<TR>
<TR>
<TH align=right>Server port:
<TD><%= request.getServerPort() %>
<TR>
<TR>
<TH align=right>Remote user:
<TD><%= request.getRemoteUser() %>
<TR>
<TR>
<TH align=right>Remote address:
<TD><%= request.getRemoteAddr() %>
<TR>
<TR>
<TH align=right>Remote host:
<TD><%= request.getRemoteHost() %>
<TR>
<TR>
<TH align=right>Authorization scheme:
<TD><%= request.getAuthType() %>
<TR>
</TABLE>
<%
Enumeration e = request.getHeaderNames();
if(e != null && e.hasMoreElements()) {
%>
<H2>Request headers
<TABLE>
<TR>
<TH align=left>Header:
<TH align=left>Value:
</TR>
<%
while(e.hasMoreElements()) {
String k = (String) e.nextElement();
%>
<TR>
<TD><%= k %>
<TD><%= request.getHeader(k) %>
</TR>
<%
}
%>
</TABLE>
<%
}
%>
<%
e = request.getParameterNames();
if(e != null && e.hasMoreElements()) {
%>
<H2>Request parameters
<TABLE>
<TR valign=top>
<TH align=left>Parameter:
<TH align=left>Value:
<TH align=left>Multiple values:
</TR>
<%
while(e.hasMoreElements()) {
String k = (String) e.nextElement();
String val = request.getParameter(k);
String vals[] = request.getParameterValues(k);
%>
<TR valign=top>
<TD><%= k.replaceAll("<", "<").replaceAll(">",">") %>
<TD><%= val.replaceAll("<", "<").replaceAll(">",">") %>
<TD><%
for(int i = 0; i < vals.length; i++) {
if(i > 0)
out.print("<BR>");
out.print(vals[i].replaceAll("<", "<").replaceAll(">",">"));
}
%></TD>
</TR>
<%
}
%>
</TABLE>
<%
}
%>
<%
e = request.getAttributeNames();
if(e != null && e.hasMoreElements()) {
%>
<H2>Request Attributes
<TABLE>
<TR valign=top>
<TH align=left>Attribute:
<TH align=left>Value:
</TR>
<%
while(e.hasMoreElements()) {
String k = (String) e.nextElement();
Object val = request.getAttribute(k);
%>
<TR valign=top>
<TD><%= k.replaceAll("<", "<").replaceAll(">",">") %>
<TD><%= val.toString().replaceAll("<", "<").replaceAll(">",">") %>
</TR>
<%
}
%>
</TABLE>
<%
}
%>
<%
e = getServletConfig().getInitParameterNames();
if(e != null && e.hasMoreElements()) {
%>
<H2>Init parameters
<TABLE>
<TR valign=top>
<TH align=left>Parameter:
<TH align=left>Value:
</TR>
<%
while(e.hasMoreElements()) {
String k = (String) e.nextElement();
String val = getServletConfig().getInitParameter(k);
%>
<TR valign=top>
<TD><%= k %>
<TD><%= val %>
</TR>
<%
}
%>
</TABLE>
<%
}
%>
</BODY>
</HTML>
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.