home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 9 / IOPROG_9.ISO / contrib / iis4 / iis4_07.cab / EnumServerVars.java < prev    next >
Encoding:
Java Source  |  1997-09-05  |  767 b   |  40 lines

  1. /**
  2.  * EnumServerVars: Using the framework to access HTTP server variables.
  3.  */
  4.  
  5. package IISSample;
  6.  
  7. import aspcomp.*;
  8.  
  9.  
  10. public class EnumServerVars 
  11. {
  12.  
  13.     public void enum()
  14.     {
  15.         Response response = AspContext.getResponse();
  16.  
  17.         response.write("<H2>Enumerating Server Variables</H2><P>");
  18.  
  19.         try 
  20.         {
  21.             Request request = AspContext.getRequest();
  22.             RequestDictionary rd = request.getServerVariables();
  23.  
  24.             while (rd.hasMoreElements()) 
  25.             {
  26.                 String str = (String)rd.nextElement();
  27.                 response.write("<B>" + str + " =</B>" + rd.getString(str) + "<P>");
  28.             }    
  29.         }
  30.  
  31.         catch (ClassCastException e) 
  32.         {
  33.             response.write("Oppps! It looks like it threw<P>");
  34.         }
  35.  
  36.         response.write("<B>done</B><P>");
  37.     }
  38.  
  39. }
  40.