home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / EnumServerVars.java < prev    next >
Text File  |  1997-10-25  |  986b  |  42 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.         // Use the Java Component Framework to enumerate through the
  20.         // server variables
  21.         try 
  22.         {
  23.             Request request = AspContext.getRequest();
  24.             RequestDictionary rd = request.getServerVariables();
  25.  
  26.             while (rd.hasMoreElements()) 
  27.             {
  28.                 String str = (String)rd.nextElement();
  29.                 response.write("<B>" + str + " =</B>" + rd.getString(str) + "<P>");
  30.             }    
  31.         }
  32.  
  33.         catch (ClassCastException e) 
  34.         {
  35.             response.write("Oppps! It looks like it threw<P>");
  36.         }
  37.  
  38.         response.write("<B>done</B><P>");
  39.     }
  40.  
  41. }
  42.