FileDocCategorySizeDatePackage
ServerSnoop.javaAPI DocExample1325Tue Jan 25 10:45:14 GMT 2000None

ServerSnoop

public class ServerSnoop extends GenericServlet

Fields Summary
Constructors Summary
Methods Summary
private java.lang.StringgetServerInfoName(java.lang.String serverInfo)

    int slash = serverInfo.indexOf('/");
    if (slash == -1) return serverInfo;
    else return serverInfo.substring(0, slash);
  
private java.lang.StringgetServerInfoVersion(java.lang.String serverInfo)

    int slash = serverInfo.indexOf('/");
    if (slash == -1) return null;
    else return serverInfo.substring(slash + 1);
  
public voidservice(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)

    res.setContentType("text/plain");
    PrintWriter out = res.getWriter();

    out.println("req.getServerName(): " + req.getServerName());
    out.println("req.getServerPort(): " + req.getServerPort());
    out.println("getServletContext().getServerInfo(): " +
                 getServletContext().getServerInfo());
    out.println("getServerInfo() name: " +
                 getServerInfoName(getServletContext().getServerInfo()));
    out.println("getServerInfo() version: " +
                 getServerInfoVersion(getServletContext().getServerInfo()));
    out.println("getServletContext().getAttribute(\"attribute\"): " + 
                 getServletContext().getAttribute("attribute"));