alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  
</tr> <tr bgcolor=#f5f5f5> <td width="30%" class="messageText">Application Server <td class="messageText"><%=(String)request.getAttribute("ServerInfo")%> </tr> <tr bgcolor=#f5f5f5> <td class="messageText">Servlet Version <td class="messageText"><%=(String)request.getAttribute("ServletVersion")%> </tr> </table> <p> <p> <table width="95%" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#999999"> <tr bgcolor="#666699" class="header"> <td colspan="2">System Information </tr> <tr bgcolor=#f5f5f5> <td width="30%" class="messageText">vmName <td class="messageText"><%=(String)request.getAttribute("vmName")%> </tr> <tr bgcolor=#f5f5f5> <td class="messageText">vmVendor <td class="messageText"><%=(String)request.getAttribute("vmVendor")%> </tr> <tr bgcolor=#f5f5f5> <td class="messageText">vmVersion <td class="messageText"><%=(String)request.getAttribute("vmVersion")%> </tr> <tr bgcolor=#f5f5f5> <td class="messageText">runtimeName <td class="messageText"><%=(String)request.getAttribute("runtimeName")%> </tr> <tr bgcolor=#f5f5f5> <td class="messageText">runtimeVersion <td class="messageText"><%=(String)request.getAttribute("runtimeVersion")%> </tr> <tr bgcolor=#f5f5f5> <td class="messageText">osName <td class="messageText"><%=(String)request.getAttribute("osName")%> </tr> <tr bgcolor=#f5f5f5> <td class="messageText">osVersion <td class="messageText"><%=(String)request.getAttribute("osVersion")%> </tr> <tr bgcolor=#f5f5f5> <td class="messageText">cpu <td class="messageText"><%=(String)request.getAttribute("cpu")%> </tr> <% Runtime runtime = Runtime.getRuntime(); long totalMemory = runtime.totalMemory(); long freeMemory = runtime.freeMemory(); long totalKB = totalMemory/1024; long freeKB = freeMemory/1024; %> <tr bgcolor=#f5f5f5> <td class="messageText">Total Memory <td class="messageText"><%=totalKB%> KB </tr> <tr bgcolor=#f5f5f5> <td class="messageText">Free Memory <td class="messageText"><%=freeKB%> KB </tr> </table> <hr> </font> </body> </html>

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<html>
<!--
  Copyright (c) 2002-2005 by MyVietnam.net. All rights reserved.
  $Author: minhnn $
  $Revision: 1.4 $
  $Date: 2005/01/18 11:01:34 $
-->

<body bgcolor="white">
<h1> Request Information 
<font size="4">
JSP Request Method: <%= request.getMethod() %>
<br>
Request URI: <%= request.getRequestURI() %>
<br>
Request Protocol: <%= request.getProtocol() %>
<br>
Servlet path: <%= request.getServletPath() %>
<br>
Context path: <%= request.getContextPath() %>
<br>
Path info: <% out.print(request.getPathInfo()); %>
<br>
Query string: <% out.print(request.getQueryString()); %>
<br>
Content length: <%= request.getContentLength() %>
<br>
Content type: <%= request.getContentType() %>
<br>
Server name: <%= request.getServerName() %>
<br>
Server port: <%= request.getServerPort() %>
<br>
Remote user: <%= request.getRemoteUser() %>
<br>
Remote address: <%= request.getRemoteAddr() %>
<br>
Remote host: <%= request.getRemoteHost() %>
<br>
Authorization scheme: <%= request.getAuthType() %> 
<br>
Locale: <%= request.getLocale() %>
<br>
Root Real Path: <%= pageContext.getServletContext().getRealPath("/") %>
<br>
WEB-INF/classes Real Path: <%= pageContext.getServletContext().getRealPath("/WEB-INF/classes") %>
<br>
Servlet Context Name: <%= pageContext.getServletContext().getServletContextName() %>
<hr>
The browser you are using is <% out.print(request.getHeader("User-Agent")); %>

<%
        ServletContext context = application;
        String serverInfo = context.getServerInfo();
        int majorVersion  = context.getMajorVersion();
        int minorVersion  = context.getMinorVersion();
        String servletVersion = new StringBuffer().append(majorVersion).append('.').append(minorVersion).toString();

        String vmName          = "";
        String vmVendor        = "";
        String vmVersion       = "";
        String runtimeName     = "";
        String runtimeVersion  = "";
        String osName          = "";
        String osVersion       = "";
        String cpu             = "";

        // get system info
        try {
            vmName          = System.getProperty("java.vm.name", "");
            vmVendor        = System.getProperty("java.vm.vendor", "");
            vmVersion       = System.getProperty("java.vm.version", "");
            runtimeName     = System.getProperty("java.runtime.name", "");
            runtimeVersion  = System.getProperty("java.runtime.version", "");
            osName          = System.getProperty("os.name", "");
            osVersion       = System.getProperty("os.version", "");
            cpu             = System.getProperty("sun.cpu.isalist", "");
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        // now save them
        request.setAttribute("ServerInfo", serverInfo);
        request.setAttribute("ServletVersion", servletVersion);

        request.setAttribute("vmName", vmName);
        request.setAttribute("vmVendor", vmVendor);
        request.setAttribute("vmVersion", vmVersion);
        request.setAttribute("runtimeName", runtimeName);
        request.setAttribute("runtimeVersion", runtimeVersion);
        request.setAttribute("osName", osName);
        request.setAttribute("osVersion", osVersion);
        request.setAttribute("cpu", cpu);
%>

<table width="95%" border="0" cellspacing="1" cellpadding="3" align="center" bgcolor="#999999">
  <tr bgcolor="#666699" class="header">
    <td colspan="2">Application Server Infomation
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

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.