snoopservlet.jsp

来自「java的一系列产品中包括jsme,jmse,j2ee,本文件提供j2ee实现的」· JSP 代码 · 共 216 行

JSP
216
字号
<!-- Copyright (c) 1999-2002 by BEA Systems, Inc. All Rights Reserved.-->

<!-- Here we use a Java string ("PAGETITLE") to set 
     the same phrase as the title and as a head.-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1">
<meta name="description" content="BEA WebLogic Server">

<meta name="keywords" content="BEA WebLogic Server">

<title>Snoop Servlet</title>

<LINK REL="stylesheet" 
TYPE="text/css" 
HREF="wls_examples.css" 
TITLE="BEA WebLogic Server">


</head>

<body bgcolor="#ffffff" link="#3366cc" vlink="#9999cc" alink="#0000cc">

<!-- top intro paragraph tables -->
<!-- RED LINE -->
<table cellspacing="0" cellpadding="0"  border="0" width="100%">
    <tr>
     <td  width="100%" bgcolor="#ff0000" height="1">
     <p class="small">&nbsp;</p>
     </td>
     </tr>
</table>

<table border=0 cellspacing="18" cellpadding="0">
<tr>
<td valign="top">
<a HREF="http://www.bea.com"><IMG SRC="images/logo_tm_onwt.jpg" alt="BEA Logo" border="0"></a>

 <h3>Snoop Servlet</h3>
 
 </td>
 </tr>
</table>

<!-- RED LINE -->
<table cellspacing="0" cellpadding="0"  border="0" width="100%">
    <tr>
     <td  width="100%" bgcolor="#ff0000" height="1">
     <p class="small">&nbsp;</p>
     </td>
     </tr>
</table>

<table border=0 cellspacing="18" cellpadding="0">
<tr>
<td valign="top">
<p>
This servlet returns information about the HTTP request
itself. You can modify this servlet to take this information
and store it elsewhere for your HTTP server records. This
servlet is also useful for debugging.

<h3>
Servlet Spec Version Implemented
</h3>

<pre>
<%= getServletConfig().getServletContext().getMajorVersion() + "." + getServletConfig().getServletContext().getMinorVersion() %>
</pre>

<h3>
Requested URL
</h3>

<pre>
<%= request.getRequestURL().toString() %>
</pre>

<h3>
Request parameters
</h3>

<pre>
<%
Enumeration enum = request.getParameterNames();
while(enum.hasMoreElements()){
  String key = (String)enum.nextElement();
  String[] paramValues = request.getParameterValues(key);
  for(int i=0;i < paramValues.length;i++){
      out.println(key + " : "  + paramValues[i]); 
  }
}
%>
</pre>

<h3>
Request information
</h3>

<pre>
Request Method: <%= request.getMethod() %>
Request URI: <%= request.getRequestURI() %>
Request Protocol: <%= request.getProtocol() %>
Servlet Path: <%= request.getServletPath() %>
Path Info: <%= request.getPathInfo() %>
Path Translated: <%= request.getPathTranslated() %>
Query String: <%= request.getQueryString() %>
Content Length: <%= request.getContentLength() %>
Content Type: <%= request.getContentType() %>
Server Name: <%= request.getServerName() %>
Server Port: <%= request.getServerPort() %>
Remote User: <%= request.getRemoteUser() %>
Remote Address: <%= request.getRemoteAddr() %>
Remote Host: <%= request.getRemoteHost() %>
Authorization Scheme: <%= request.getAuthType() %>
</pre>

<h3>Certificate Information</h3>
<pre>
<%
  try {
    java.security.cert.X509Certificate certs [] = (java.security.cert.X509Certificate [])
	request.getAttribute("javax.servlet.request.X509Certificate");

    if ((certs != null) && (certs.length > 0)) {
%>
Subject Name : <%= certs[0].getSubjectDN().getName() %> <br>
Issuer Name :<%= certs[0].getIssuerDN().getName() %> <br>
Certificate Chain Length : <%= certs.length %> <br>
<%
      // List the Certificate chain
      for (int i=0; i<certs.length;i++) {
%>  Certificate[<%= i %>] : <%= certs[i].toString() %> 
<%
      } // end of for loop
%>
<%
    } 
    else // certs==null 
    {
%>
Not using SSL or client certificate not required.
<%
    }
  } catch (ClassCastException cce) {
    System.out.println(cce.getMessage());
    cce.printStackTrace();
  }
%>
</pre>


<h3>
Request headers
</h3>

<pre>
<%
enum = request.getHeaderNames();
while (enum.hasMoreElements()) {
  String name = (String)enum.nextElement();
  out.println(name + ": " + request.getHeader(name));
}
%>
</pre>

 </td>
 </tr>
</table>
<br>
<!-- RED LINE -->
<table cellspacing="0" cellpadding="0"  border="0" width="100%">
    <tr>
     <td  width="100%" bgcolor="#ff0000" height="1">
     <p class="small">&nbsp;</p>
     </td>
     </tr>
</table>

<!-- FOOTER -->
<table cellspacing="0" cellpadding="0" border="0" width="100%">
  <tr>
    <td align="left">
      <p class="copyright">Last updated: March 2002</p>
    </td>
  </tr>
</table>

<table cellspacing="0" cellpadding="0" border="0" width="100%"><!-- RED LINE -->
   <tr> 
    <td  width="100%" bgcolor="#ff0000" height="1">
    <p class="small">&nbsp;</p>
    </td>
    </tr>
</table> 


 <p class="copyright"><a href="http://www.bea.com">Home</a> | 
        <a href="http://www.bea.com/about/index.html" target="_top">Corporate Info</a> | 
        <a href="http://www.bea.com/press/index.html" target="_top">News</a> | 
        <a href="http://www.bea.com/solutions/index.html" target="_top">Solutions</a> | 
        <a href="http://www.bea.com/products/index.html" target="_top">Products</a> | 
        <a href="http://www.bea.com/partners/index.html" target="_top">Partners</a> | 
        <a href="http://www.bea.com/services.html" target="_top">Services</a> | 
        <a href="http://www.bea.com/events/index.html" target="_top">Events</a> | 
        <a href="http://www.bea.com/download.html" target="_top">Download</a> | 
        <a href="http://www.bea.com/purchase.html" target="_top">How to Buy</a>
        <br>Copyright 2002, BEA Systems, Inc. All rights reserved. 
        <br>Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
        <br> <a href="http://www.bea.com/contact/index.html" target="_top">Contact BEA</a> 
      </p>

</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?