Snoop Servlet

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.

Servlet Spec Version Implemented

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

Requested URL

<%= HttpUtils.getRequestURL(request) %>

Init parameters

<%
Enumeration e = getServletConfig().getInitParameterNames();
while (e.hasMoreElements()) {
  String name = (String)e.nextElement();
  out.println(name + ": " + getServletConfig().getInitParameter(name));
}
%>

Request information

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() %>

Certificate Information

<%
  try {
    weblogic.security.X509 certs [] = (weblogic.security.X509 [])
	request.getAttribute("javax.net.ssl.peer_certificates");

    if (certs != null) {
      weblogic.security.JDK11Certificate jdk11cert = new weblogic.security.JDK11Certificate(certs[0]);
%>
Subject Name : <%= jdk11cert.getPrincipal().getName() %> 
Issuer Name :<%= jdk11cert.getGuarantor().getName() %>
Certificate Chain Length : <%= certs.length %>
<% // List the Certificate chain for (int i=0; i Certificate[<%= i %>] : <%= certs[i].toString() %> <% } // end of for loop %> <% } else // certs==null { %> Not using SSL or client certificate not required in weblogic.properties. <% } } catch (ClassCastException cce) { System.out.println(cce.getMessage()); cce.printStackTrace(); } %>

Request headers

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

Copyright © 1999-2000 by BEA Systems, Inc. All Rights Reserved.