package _gsp;
import com.bitmechanic.gsp.*;
import javax.servlet.http.*;
import java.util.Enumeration; //i:\os2httpd\public\htdocs\gsp\env.gsp:1
import java.util.Hashtable; //i:\os2httpd\public\htdocs\gsp\env.gsp:2


public class ___env implements Template {
  private static String __strArr[] = {
    "\n",
    "\n<html>\n<head>\n<title>EnvDumpServlet</title>\n</head>\n<body bgcolor=\"#ffffff\">\n<h3>EnvDumpServlet</h3>\n<h4>Headers available via HttpServletRequest.getHeader() </h4>\n<table border=\"1\">\n\n",
    "\n\n</table><P>\n<h4>Attributes available via HttpServletRequest.getAttribute()</h4>\n<table border=\"1\">\n\n",
    "\n\n</table><P>\n<h4>Form Elements available from HttpUtils.parsePostData()</h4>\n<table border=\"1\">\n\n",
    "\n\n</table><P>\n</body>\n</html>\n",
  };
	private static char[][] __byteArr;
	static {
	  __byteArr = new char[__strArr.length][];
	  for(int i = 0; i < __strArr.length; i++) {
	    __byteArr[i] = __strArr[i].toCharArray();
	  }
	  __strArr = null;
	}
	//note current time for comparisons latter
	private static long __parseTime = Long.parseLong("942719345927");
	private static com.bitmechanic.gsp.FileDependancy __dependancies[] = {  
		new com.bitmechanic.gsp.FileDependancy ("i:\\os2httpd\\public\\htdocs\\gsp\\env.gsp","917922188000")};
	public boolean usesPrintWriter() {
		return true;
	}
	public boolean shouldCache() {
		boolean __shouldCache = true;
		for (int i = 0; i < __dependancies.length && __shouldCache; i++) {
			if (!__dependancies[i].isCurrent())
				__shouldCache = false;
		}
		return __shouldCache;
	}

	public long getParseTime() { return this.__parseTime; }
	private java.util.Hashtable __cacheHash = new java.util.Hashtable();
	public synchronized void flushExpiredCacheData() {
	  if(__cacheHash != null) {
		long now = System.currentTimeMillis();
		for(java.util.Enumeration e = __cacheHash.keys(); e.hasMoreElements();) {
			Object key = e.nextElement();
			CachedString cs = (CachedString)__cacheHash.get(key);
			if(cs.hasExpired(now)) __cacheHash.remove(key);
		}
	  }
	}
	public synchronized void flushAllCacheData() {
	  if(__cacheHash != null) {
		__cacheHash.clear();
	  }
	}


	public ___env () {}

	public void render(Application application, GspRequest request, GspResponse response) throws Exception {
		java.io.PrintWriter out = response.getWriter();
	out.write(__byteArr[0]);
	out.write(__byteArr[1]);
 //i:\os2httpd\public\htdocs\gsp\env.gsp:12
    // print headers //i:\os2httpd\public\htdocs\gsp\env.gsp:13
    Enumeration headers = request.getHeaderNames(); //i:\os2httpd\public\htdocs\gsp\env.gsp:14
    while ( headers.hasMoreElements()) { //i:\os2httpd\public\htdocs\gsp\env.gsp:15
        String hdr = headers.nextElement().toString(); //i:\os2httpd\public\htdocs\gsp\env.gsp:16
        out.println("<TR><TD><B>"+hdr + "</B></TD><TD>"+request.getHeader(hdr)+"</TD></TR>"); //i:\os2httpd\public\htdocs\gsp\env.gsp:17
    } //i:\os2httpd\public\htdocs\gsp\env.gsp:18
    out.println("<TR><TD><B>accept</B></TD><TD>image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*</TD></TR>"); //i:\os2httpd\public\htdocs\gsp\env.gsp:19
 //i:\os2httpd\public\htdocs\gsp\env.gsp:20
	out.write(__byteArr[2]);
 //i:\os2httpd\public\htdocs\gsp\env.gsp:26
    // print attributes //i:\os2httpd\public\htdocs\gsp\env.gsp:27
    String prefix = "org.apache.jserv."; //i:\os2httpd\public\htdocs\gsp\env.gsp:28
    Object attrsObj = request.getAttribute("org.apache.jserv.attribute_names"); //i:\os2httpd\public\htdocs\gsp\env.gsp:29
    if ( attrsObj != null && attrsObj instanceof Enumeration ) { //i:\os2httpd\public\htdocs\gsp\env.gsp:30
        Enumeration attrs = (Enumeration) attrsObj; //i:\os2httpd\public\htdocs\gsp\env.gsp:31
        while ( attrs.hasMoreElements()) { //i:\os2httpd\public\htdocs\gsp\env.gsp:32
            String attr = attrs.nextElement().toString(); //i:\os2httpd\public\htdocs\gsp\env.gsp:33
            if ( request.getAttribute(prefix + attr) != null ) { //i:\os2httpd\public\htdocs\gsp\env.gsp:34
	        out.println("<TR><TD><B>"+prefix + attr + "</B></TD><TD>"+request.getAttribute(prefix + attr).toString()+"</TD></TR>"); //i:\os2httpd\public\htdocs\gsp\env.gsp:35
	    } else { //i:\os2httpd\public\htdocs\gsp\env.gsp:36
	        out.println("<TR><TD><B>"+prefix + attr + "</B></TD><TD></TD></TR>"); //i:\os2httpd\public\htdocs\gsp\env.gsp:37
            } //i:\os2httpd\public\htdocs\gsp\env.gsp:38
        } //i:\os2httpd\public\htdocs\gsp\env.gsp:39
    } //i:\os2httpd\public\htdocs\gsp\env.gsp:40
 //i:\os2httpd\public\htdocs\gsp\env.gsp:41
	out.write(__byteArr[3]);
 //i:\os2httpd\public\htdocs\gsp\env.gsp:47
    // Look for POST data //i:\os2httpd\public\htdocs\gsp\env.gsp:48
    String post = request.getMethod(); //i:\os2httpd\public\htdocs\gsp\env.gsp:49
    if(post.equals("POST")) { //i:\os2httpd\public\htdocs\gsp\env.gsp:50
        Hashtable nvPairs = HttpUtils.parsePostData(request.getIntHeader("content-length"), request.getInputStream()); //i:\os2httpd\public\htdocs\gsp\env.gsp:51
        Enumeration keys = nvPairs.keys(); //i:\os2httpd\public\htdocs\gsp\env.gsp:52
        while (keys.hasMoreElements()) { //i:\os2httpd\public\htdocs\gsp\env.gsp:53
            String key = (String) keys.nextElement(); //i:\os2httpd\public\htdocs\gsp\env.gsp:54
            out.print("<TR><TD><B>"+key+"</B></TD><TD>"); //i:\os2httpd\public\htdocs\gsp\env.gsp:55
            String[] values = (String[]) nvPairs.get(key); //i:\os2httpd\public\htdocs\gsp\env.gsp:56
	    for(int i=0; i<values.length; i++) { //i:\os2httpd\public\htdocs\gsp\env.gsp:57
	        out.print(""+values[i]+"<BR>"); //i:\os2httpd\public\htdocs\gsp\env.gsp:58
            } //i:\os2httpd\public\htdocs\gsp\env.gsp:59
	    out.print("</TD></TR>"); //i:\os2httpd\public\htdocs\gsp\env.gsp:60
        } //i:\os2httpd\public\htdocs\gsp\env.gsp:61
    } //i:\os2httpd\public\htdocs\gsp\env.gsp:62
 //i:\os2httpd\public\htdocs\gsp\env.gsp:63
	out.write(__byteArr[4]);
		out.flush();
	}
}
