package com.ibm.ivj.wte.samples.servletconfig;
// Licensed Material - Property of IBM
// (C) Copyright IBM Corp. 2000 - All Rights Reserved
//
// DISCLAIMER:
// The following [enclosed] code is sample code created by IBM
// Corporation. This sample code is not part of any standard IBM product
// and is provided to you solely for the purpose of assisting you in the
// development of your applications. The code is provided 'AS IS',
// without warranty or condition of any kind. IBM shall not be liable for any damages
// arising out of your use of the sample code, even if IBM has been
// advised of the possibility of such damages.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Enumeration;
import com.ibm.servlet.engine.*;
import com.ibm.servlet.engine.srt.*;
import com.ibm.servlet.engine.config.*;
import com.ibm.servlet.util.*;
import java.util.*;
/**
* Config Dumper
*
*
This servlet dumps the current servlet engine configuration
*/
public class ServletEngineConfigDumper extends HttpServlet
{
private static final String copyright =
"(c) Copyright IBM Corporation 2000.";
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
// Set a break point at the next line
String cmd = req.getParameter("cmd");
if ( cmd == null )
{
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("
");
out.println("Property | Value |
");
out.println("Operating System | " + System.getProperty("os.name") + " |
");
out.println("Operating System Version | " + System.getProperty("os.version") + " |
");
out.println("Hardware Architecture | " + System.getProperty("os.arch") + " |
");
out.println("JVM Version | " + System.getProperty("java.version") + " |
");
out.println("JVM Vendor | " + System.getProperty("java.vendor") + " |
");
out.println("JVM Vendor URL | " + System.getProperty("java.vendor.url") + " |
");
out.println("JVM Class Version | " + System.getProperty("java.class.version") + " |
");
out.println("JVM Home Directory | " + System.getProperty("java.home") + " |
");
out.println("JVM Compiler (JIT) | " + System.getProperty("java.compiler") + " |
");
out.println("JVM Class Path | ");
String cp = System.getProperty("java.class.path");
StringTokenizer tokenizer = new StringTokenizer(cp, File.pathSeparator);
while ( tokenizer.hasMoreTokens() )
{
out.println("- " + tokenizer.nextToken());
}
out.println("
|
");
out.println("File Separator | " + System.getProperty("file.separator") + " |
");
out.println("Path Separator | " + System.getProperty("path.separator") + " |
");
out.println("Line Separator | " + System.getProperty("line.separator") + " |
");
out.println("User Name | " + System.getProperty("user.name") + " |
");
out.println("User Home Directory | " + System.getProperty("user.home") + " |
");
out.println("Current Working Directory | " + System.getProperty("user.dir") + " |
");
out.println("User Language | " + System.getProperty("user.language") + " |
");
out.println("User Region | " + System.getProperty("user.region") + " |
");
out.println("User Timezone | " + System.getProperty("user.timezone") + " |
");
out.println("File Encoding | " + System.getProperty("file.encoding") + " |
");
out.println("File Encoding Package | " + System.getProperty("file.encoding.pkg") + " |
");
Enumeration propKeys = System.getProperties().keys();
while ( propKeys.hasMoreElements() )
{
String key = (String)propKeys.nextElement();
if ( !key.equals("os.name") &&
!key.equals("os.version") &&
!key.equals("os.arch") &&
!key.equals("java.version") &&
!key.equals("java.vendor") &&
!key.equals("java.vendor.url") &&
!key.equals("java.class.version") &&
!key.equals("java.home") &&
!key.equals("java.compiler") &&
!key.equals("java.class.path") &&
!key.equals("file.separator") &&
!key.equals("path.separator") &&
!key.equals("line.separator") &&
!key.equals("user.name") &&
!key.equals("user.home") &&
!key.equals("user.dir") &&
!key.equals("user.language") &&
!key.equals("user.region") &&
!key.equals("user.timezone") &&
!key.equals("file.encoding") &&
!key.equals("file.encoding.pkg") )
{
String value = System.getProperty(key);
out.println("" + key + " | " + value + " |
");
}
}
out.println("
");
out.println("");
out.println("Description: | " + appInfo.getDescription() + " |
");
out.println("Virtual Host: | " + vhost + " |
");
out.println("Engine: | " + engineInfo.getName() + " |
");
out.println("Document Root: | " + wgInfo.getDocumentRoot() + " |
");
out.println("Classpath: | " + wgInfo.getClasspath() + " |
");
out.println("Root URI: | " + wgInfo.getRootURI() + " |
");
out.println("Shared Context In Use: | " + wgInfo.isSharedContext() + " |
");
out.println("Shared Context JNDI Name: | " + wgInfo.getSharedContextJNDIName() + " |
");
out.println("Auto reload: | " + wgInfo.isAutoReload() + " |
");
out.println("Auto reload polling interval: | " + wgInfo.getAutoReloadPollingInterval() / 1000 + " seconds |
");
out.println("Error Page: | " + appInfo.getErrorPage() + " |
");
out.println("
");
out.println("