/*
EnumServerVars: Using the framework to access HTTP server variables.
*/
package IISSample;
import com.ms.iis.asp.*; // use latest package
public class EnumServerVars
{
public void enum()
{
Response response = AspContext.getResponse();
response.write("
Enumerating Server Variables
");
// Output these in a table format
response.write("
");
response.write("Name | Value |
");
// Use the Java Component Framework to enumerate through the
// server variables
try
{
Request request = AspContext.getRequest();
RequestDictionary rd = request.getServerVariables();
while (rd.hasMoreItems())
{
String str = (String)rd.nextItem();
response.write("" + str + " | " + rd.getString(str) + " |
" );
}
}
catch (ClassCastException e)
{
response.write("Oppps! It looks like it threw");
}
}
}