UWeb
Class HelloWeb

source: e:\games\UnrealTournament\UWeb\Classes\HelloWeb.uc
Core.Object
   |
   +--UWeb.WebApplication
      |
      +--UWeb.HelloWeb
Direct Known Subclasses:None

class HelloWeb
extends UWeb.WebApplication



Source Code


00001	class HelloWeb expands WebApplication;
00002	
00003	/* Usage:
00004	This is a sample web application, to demonstrate how to program for the web server.
00005	
00006	
00007	[UWeb.WebServer]
00008	Applications[0]="UWeb.HelloWeb"
00009	ApplicationPaths[0]="/hello"
00010	bEnabled=True
00011	
00012	http://server.ip.address/hello
00013	
00014	*/
00015	
00016	event Query(WebRequest Request, WebResponse Response)
00017	{
00018		local int i;
00019	
00020		if(Request.Username != "test" || Request.Password != "test")
00021		{
00022			Response.FailAuthentication("HelloWeb");
00023			return;
00024		}		
00025	
00026		switch(Request.URI)
00027		{
00028		case "/form.html":
00029			Response.SendText("<form method=post action=submit.html>");
00030			Response.SendText("<input type=edit name=TestEdit>");
00031			Response.SendText("<p><select multiple name=selecter>");
00032			Response.SendText("<option value=\"one\">Number One");
00033			Response.SendText("<option value=\"two\">Number Two");
00034			Response.SendText("<option value=\"three\">Number Three");
00035			Response.SendText("<option value=\"four\">Number Four");
00036			Response.SendText("</select><p>");
00037			Response.SendText("<input type=submit name=Submit value=Submit>");
00038			Response.SendText("</form>");
00039			break;
00040		case "/submit.html":
00041			Response.SendText("Thanks for submitting the form.<br>");
00042			Response.SendText("TestEdit was \""$Request.GetVariable("TestEdit")$"\"<p>");
00043			Response.SendText("You selected these items:<br>");
00044			for(i=Request.GetVariableCount("selecter")-1;i>=0;i--)
00045				Response.SendText("\""$Request.GetVariableNumber("selecter", i)$"\"<br>");
00046			break;
00047		case "/include.html":
00048			Response.Subst("variable1", "This is variable 1");
00049			Response.Subst("variable2", "This is variable 2");
00050			Response.Subst("variable3", "This is variable 3");
00051			Response.IncludeUHTM("testinclude.html");
00052			break;
00053		default:		
00054			Response.SendText("Hello web!  The current level is "$Level.Title);
00055			Response.SendText("<br>Click <a href=\"form.html\">this link</a> to go to a test form");
00056			break;
00057		}
00058	}
00059	
00060	defaultproperties
00061	{
00062	}

End Source Code