<html>
<head>
<title>contexttester Source</title>
</head>
<body>
<plaintext>
contexttester.ctf

<%
	display_form = true
	action = Request().Form("action")
	
	if action <> null then
		action = action.toLowerCase()
		
		if action = "set value" then
			key = Request().Form("key")
			if key <> null then
				key = key.trim()
				if key.length() > 0 then
					value = Request().Form("value")
					if value = null then
						value = ""
					else
						value = value.trim()
					end

					Context().setAttribute(key, value)
				end
			end
		elseif action = "remove value" then
			key = Request().Form("key")
			if key <> null then
				key = key.trim()

				if key.length() > 0 then
					Context().removeAttribute(key)
				end
			end
		elseif action = "dump context" then
			Response().redirect("./dumpcontext.ctf")
			display_form = false
		end
	end
	if display_form then
%>
<html>
    <head>
        <title>Context Tester</title>
    </head>
    <body>
		<h1>Context Tester</h1>
		<hr>

		<%call(path() + separator() + "dump_context.cef")%>

		<hr>

		<form action="./contexttester.ctf" method="get">
		Key:
		<input type="text" name="key" value="">
		<br>
		Value:
		<input type="text" name="value" value="">
		<p>
		<input type="submit" name = "action" value="Set Value">
		<input type="submit" name = "action" value="Remove Value">
		<input type="submit" name = "action" value="Dump Context">
		</form>

	</body>
</html>
<%	end%>

==================================================
dumpcontext.ctf

#!/bin/sh /ss/bin/ss.exe
<html>
    <head>
        <title>Dump Context</title>
    </head>
    <body>
		<h1>Dump Context</h1>
		<hr>

		<%call(path() + separator() +"dump_context.cef")%>

		<hr>		
		<a href="./contexttester.ctf">Context Tester</a>
	</body>
</html>


==================================================
dump_context.cef

Response().println("<p>Parameters: <br>")

e = Context().getInitParameterNames()
do while e.hasMoreElements()
	key = e.nextElement().toString()
	value = Context().getInitParameter(key).toString()

	Response().println(key + " = [" + value + "]<br>")
loop

Response().println("<p>Attributes: <br>")

e = Context().getAttributeNames()
do while e.hasMoreElements()
	key = e.nextElement().toString()
	Response().println(key + " = [" + Context().getAttribute(key).toString() + "]<br>")
loop

