Added REST-handler interface for the http server and changed the Admin Web front end to one.
parent
a4fc6b5fbb
commit
39c7fe5ec7
|
@ -1,4 +1,4 @@
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectType>Local</ProjectType>
|
<ProjectType>Local</ProjectType>
|
||||||
<ProductVersion>8.0.50727</ProductVersion>
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
@ -6,7 +6,8 @@
|
||||||
<ProjectGuid>{36895293-A627-42EC-BA77-6AF6F5A4A7DF}</ProjectGuid>
|
<ProjectGuid>{36895293-A627-42EC-BA77-6AF6F5A4A7DF}</ProjectGuid>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ApplicationIcon></ApplicationIcon>
|
<ApplicationIcon>
|
||||||
|
</ApplicationIcon>
|
||||||
<AssemblyKeyContainerName>
|
<AssemblyKeyContainerName>
|
||||||
</AssemblyKeyContainerName>
|
</AssemblyKeyContainerName>
|
||||||
<AssemblyName>OpenGridServices.UserServer</AssemblyName>
|
<AssemblyName>OpenGridServices.UserServer</AssemblyName>
|
||||||
|
@ -15,9 +16,11 @@
|
||||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
<DelaySign>false</DelaySign>
|
<DelaySign>false</DelaySign>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AppDesignerFolder></AppDesignerFolder>
|
<AppDesignerFolder>
|
||||||
|
</AppDesignerFolder>
|
||||||
<RootNamespace>OpenGridServices.UserServer</RootNamespace>
|
<RootNamespace>OpenGridServices.UserServer</RootNamespace>
|
||||||
<StartupObject></StartupObject>
|
<StartupObject>
|
||||||
|
</StartupObject>
|
||||||
<FileUpgradeFlags>
|
<FileUpgradeFlags>
|
||||||
</FileUpgradeFlags>
|
</FileUpgradeFlags>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -28,7 +31,8 @@
|
||||||
<ConfigurationOverrideFile>
|
<ConfigurationOverrideFile>
|
||||||
</ConfigurationOverrideFile>
|
</ConfigurationOverrideFile>
|
||||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
<DocumentationFile></DocumentationFile>
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
<DebugSymbols>True</DebugSymbols>
|
<DebugSymbols>True</DebugSymbols>
|
||||||
<FileAlignment>4096</FileAlignment>
|
<FileAlignment>4096</FileAlignment>
|
||||||
<Optimize>False</Optimize>
|
<Optimize>False</Optimize>
|
||||||
|
@ -37,7 +41,8 @@
|
||||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn></NoWarn>
|
<NoWarn>
|
||||||
|
</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
@ -46,7 +51,8 @@
|
||||||
<ConfigurationOverrideFile>
|
<ConfigurationOverrideFile>
|
||||||
</ConfigurationOverrideFile>
|
</ConfigurationOverrideFile>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<DocumentationFile></DocumentationFile>
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
<DebugSymbols>False</DebugSymbols>
|
<DebugSymbols>False</DebugSymbols>
|
||||||
<FileAlignment>4096</FileAlignment>
|
<FileAlignment>4096</FileAlignment>
|
||||||
<Optimize>True</Optimize>
|
<Optimize>True</Optimize>
|
||||||
|
@ -55,30 +61,31 @@
|
||||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn></NoWarn>
|
<NoWarn>
|
||||||
|
</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" >
|
<Reference Include="System">
|
||||||
<HintPath>System.dll</HintPath>
|
<HintPath>System.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Data" >
|
<Reference Include="System.Data">
|
||||||
<HintPath>System.Data.dll</HintPath>
|
<HintPath>System.Data.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml" >
|
<Reference Include="System.Xml">
|
||||||
<HintPath>System.Xml.dll</HintPath>
|
<HintPath>System.Xml.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="OpenSim.Framework.dll" >
|
<Reference Include="OpenSim.Framework.dll">
|
||||||
<HintPath>..\bin\OpenSim.Framework.dll</HintPath>
|
<HintPath>..\bin\OpenSim.Framework.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="OpenSim.Framework.Console.dll" >
|
<Reference Include="OpenSim.Framework.Console.dll">
|
||||||
<HintPath>..\bin\OpenSim.Framework.Console.dll</HintPath>
|
<HintPath>..\bin\OpenSim.Framework.Console.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="libsecondlife.dll" >
|
<Reference Include="libsecondlife.dll">
|
||||||
<HintPath>..\bin\libsecondlife.dll</HintPath>
|
<HintPath>..\bin\libsecondlife.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -86,9 +93,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ConsoleCmds.cs">
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Main.cs">
|
<Compile Include="Main.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -106,4 +110,4 @@
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -11,7 +11,6 @@
|
||||||
<resources prefix="OpenGridServices.UserServer" dynamicprefix="true" >
|
<resources prefix="OpenGridServices.UserServer" dynamicprefix="true" >
|
||||||
</resources>
|
</resources>
|
||||||
<sources failonempty="true">
|
<sources failonempty="true">
|
||||||
<include name="ConsoleCmds.cs" />
|
|
||||||
<include name="Main.cs" />
|
<include name="Main.cs" />
|
||||||
<include name="UserHttp.cs" />
|
<include name="UserHttp.cs" />
|
||||||
<include name="Properties/AssemblyInfo.cs" />
|
<include name="Properties/AssemblyInfo.cs" />
|
||||||
|
|
|
@ -0,0 +1,164 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace OpenSim.CAPS
|
||||||
|
{
|
||||||
|
public class AdminWebFront : IRestHandler
|
||||||
|
{
|
||||||
|
private string AdminPage;
|
||||||
|
private string NewAccountForm;
|
||||||
|
private string LoginForm;
|
||||||
|
private string passWord = "Admin";
|
||||||
|
|
||||||
|
public AdminWebFront(string password)
|
||||||
|
{
|
||||||
|
passWord = password;
|
||||||
|
LoadAdminPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string HandleREST(string requestBody, string requestURL, string requestMethod)
|
||||||
|
{
|
||||||
|
string responseString = "";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
switch (requestURL)
|
||||||
|
{
|
||||||
|
case "/Admin":
|
||||||
|
if (requestMethod == "GET")
|
||||||
|
{
|
||||||
|
responseString = AdminPage;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "/Admin/Accounts":
|
||||||
|
if (requestMethod == "GET")
|
||||||
|
{
|
||||||
|
responseString = "<p> Account management </p>";
|
||||||
|
responseString += "<br> ";
|
||||||
|
responseString += "<p> Create New Account </p>";
|
||||||
|
responseString += NewAccountForm;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "/Admin/Clients":
|
||||||
|
if (requestMethod == "GET")
|
||||||
|
{
|
||||||
|
responseString = " <p> Listing connected Clients </p>";
|
||||||
|
OpenSim.world.Avatar TempAv;
|
||||||
|
foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
|
||||||
|
{
|
||||||
|
if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
|
||||||
|
{
|
||||||
|
TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
|
||||||
|
responseString += "<p>";
|
||||||
|
responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
|
||||||
|
responseString += "</p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "/Admin/NewAccount":
|
||||||
|
if (requestMethod == "POST")
|
||||||
|
{
|
||||||
|
string[] comp = new string[10];
|
||||||
|
string[] passw = new string[3];
|
||||||
|
string delimStr = "&";
|
||||||
|
char[] delimiter = delimStr.ToCharArray();
|
||||||
|
string delimStr2 = "=";
|
||||||
|
char[] delimiter2 = delimStr2.ToCharArray();
|
||||||
|
|
||||||
|
//Console.WriteLine(requestBody);
|
||||||
|
comp = requestBody.Split(delimiter);
|
||||||
|
passw = comp[3].Split(delimiter2);
|
||||||
|
if (passw[1] == passWord)
|
||||||
|
{
|
||||||
|
responseString = "<p> New Account created </p>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responseString = "<p> Admin password is incorrect, please login with the correct password</p>";
|
||||||
|
responseString += "<br><br>" + LoginForm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "/Admin/Login":
|
||||||
|
if (requestMethod == "POST")
|
||||||
|
{
|
||||||
|
// Console.WriteLine(requestBody);
|
||||||
|
if (requestBody == passWord)
|
||||||
|
{
|
||||||
|
responseString = "<p> Login Successful </p>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responseString = "<p> Password Error </p>";
|
||||||
|
responseString += "<p> Please Login with the correct password </p>";
|
||||||
|
responseString += "<br><br> " + LoginForm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "/Admin/Welcome":
|
||||||
|
if (requestMethod == "GET")
|
||||||
|
{
|
||||||
|
responseString = "Welcome to the OpenSim Admin Page";
|
||||||
|
responseString += "<br><br><br> " + LoginForm;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
return responseString;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadAdminPage()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StreamReader SR;
|
||||||
|
string lines;
|
||||||
|
AdminPage = "";
|
||||||
|
NewAccountForm = "";
|
||||||
|
LoginForm = "";
|
||||||
|
SR = File.OpenText("testadmin.htm");
|
||||||
|
|
||||||
|
while (!SR.EndOfStream)
|
||||||
|
{
|
||||||
|
lines = SR.ReadLine();
|
||||||
|
AdminPage += lines + "\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
SR.Close();
|
||||||
|
|
||||||
|
SR = File.OpenText("newaccountform.htm");
|
||||||
|
|
||||||
|
while (!SR.EndOfStream)
|
||||||
|
{
|
||||||
|
lines = SR.ReadLine();
|
||||||
|
NewAccountForm += lines + "\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
SR.Close();
|
||||||
|
|
||||||
|
SR = File.OpenText("login.htm");
|
||||||
|
|
||||||
|
while (!SR.EndOfStream)
|
||||||
|
{
|
||||||
|
lines = SR.ReadLine();
|
||||||
|
LoginForm += lines + "\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
SR.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.CAPS
|
||||||
|
{
|
||||||
|
public interface IRestHandler
|
||||||
|
{
|
||||||
|
string HandleREST(string requestBody, string requestURL, string requestMethod);
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,17 +48,13 @@ namespace OpenSim.CAPS
|
||||||
{
|
{
|
||||||
public Thread HTTPD;
|
public Thread HTTPD;
|
||||||
public HttpListener Listener;
|
public HttpListener Listener;
|
||||||
private string AdminPage;
|
private Dictionary<string, IRestHandler> restHandlers = new Dictionary<string, IRestHandler>();
|
||||||
private string NewAccountForm;
|
|
||||||
private string LoginForm;
|
|
||||||
private string passWord = "Admin";
|
|
||||||
|
|
||||||
public SimCAPSHTTPServer()
|
public SimCAPSHTTPServer()
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting up HTTP Server");
|
||||||
HTTPD = new Thread(new ThreadStart(StartHTTP));
|
HTTPD = new Thread(new ThreadStart(StartHTTP));
|
||||||
HTTPD.Start();
|
HTTPD.Start();
|
||||||
LoadAdminPage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartHTTP()
|
public void StartHTTP()
|
||||||
|
@ -84,7 +80,18 @@ namespace OpenSim.CAPS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ParseXMLRPC(string requestBody)
|
public bool AddRestHandler(string path, IRestHandler handler)
|
||||||
|
{
|
||||||
|
if (!this.restHandlers.ContainsKey(path))
|
||||||
|
{
|
||||||
|
this.restHandlers.Add(path, handler);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//must already have a handler for that path so return false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
protected virtual string ParseXMLRPC(string requestBody)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -116,104 +123,34 @@ namespace OpenSim.CAPS
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ParseREST(string requestBody, string requestURL, string requestMethod)
|
protected virtual string ParseREST(string requestBody, string requestURL, string requestMethod)
|
||||||
{
|
{
|
||||||
|
string[] path;
|
||||||
|
string pathDelimStr = "/";
|
||||||
|
char[] pathDelimiter = pathDelimStr.ToCharArray();
|
||||||
|
path = requestURL.Split(pathDelimiter);
|
||||||
|
|
||||||
string responseString = "";
|
string responseString = "";
|
||||||
try
|
|
||||||
|
//path[0] should be empty so we are interested in path[1]
|
||||||
|
if (path.Length > 1)
|
||||||
{
|
{
|
||||||
switch (requestURL)
|
if ((path[1] != "") && (this.restHandlers.ContainsKey(path[1])))
|
||||||
{
|
{
|
||||||
case "/Admin/Accounts":
|
responseString = this.restHandlers[path[1]].HandleREST(requestBody, requestURL, requestMethod);
|
||||||
if (requestMethod == "GET")
|
|
||||||
{
|
|
||||||
responseString = "<p> Account management </p>";
|
|
||||||
responseString += "<br> ";
|
|
||||||
responseString += "<p> Create New Account </p>";
|
|
||||||
responseString += NewAccountForm;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "/Admin/Clients":
|
|
||||||
if (requestMethod == "GET")
|
|
||||||
{
|
|
||||||
responseString = " <p> Listing connected Clients </p>";
|
|
||||||
OpenSim.world.Avatar TempAv;
|
|
||||||
foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
|
|
||||||
{
|
|
||||||
if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
|
|
||||||
{
|
|
||||||
TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
|
|
||||||
responseString += "<p>";
|
|
||||||
responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
|
|
||||||
responseString += "</p>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "/Admin/NewAccount":
|
|
||||||
if (requestMethod == "POST")
|
|
||||||
{
|
|
||||||
string[] comp = new string[10];
|
|
||||||
string[] passw = new string[3];
|
|
||||||
string delimStr = "&";
|
|
||||||
char[] delimiter = delimStr.ToCharArray();
|
|
||||||
string delimStr2 = "=";
|
|
||||||
char[] delimiter2 = delimStr2.ToCharArray();
|
|
||||||
|
|
||||||
//Console.WriteLine(requestBody);
|
|
||||||
comp = requestBody.Split(delimiter);
|
|
||||||
passw = comp[3].Split(delimiter2);
|
|
||||||
if (passw[1] == passWord)
|
|
||||||
{
|
|
||||||
responseString = "<p> New Account created </p>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responseString = "<p> Admin password is incorrect, please login with the correct password</p>";
|
|
||||||
responseString += "<br><br>" + LoginForm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "/Admin/Login":
|
|
||||||
if (requestMethod == "POST")
|
|
||||||
{
|
|
||||||
// Console.WriteLine(requestBody);
|
|
||||||
if (requestBody == passWord)
|
|
||||||
{
|
|
||||||
responseString = "<p> Login Successful </p>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responseString = "<p> Password Error </p>";
|
|
||||||
responseString += "<p> Please Login with the correct password </p>";
|
|
||||||
responseString += "<br><br> " + LoginForm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "/Admin/Welcome":
|
|
||||||
if (requestMethod == "GET")
|
|
||||||
{
|
|
||||||
responseString = "Welcome to the OpenSim Admin Page";
|
|
||||||
responseString += "<br><br><br> " + LoginForm;
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return responseString;
|
return responseString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ParseLLSDXML(string requestBody)
|
protected virtual string ParseLLSDXML(string requestBody)
|
||||||
{
|
{
|
||||||
// dummy function for now - IMPLEMENT ME!
|
// dummy function for now - IMPLEMENT ME!
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleRequest(Object stateinfo)
|
public virtual void HandleRequest(Object stateinfo)
|
||||||
{
|
{
|
||||||
// Console.WriteLine("new http incoming");
|
// Console.WriteLine("new http incoming");
|
||||||
HttpListenerContext context = (HttpListenerContext)stateinfo;
|
HttpListenerContext context = (HttpListenerContext)stateinfo;
|
||||||
|
@ -258,17 +195,9 @@ namespace OpenSim.CAPS
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case null:
|
case null:
|
||||||
if ((request.HttpMethod == "GET") && (request.RawUrl == "/Admin"))
|
// must be REST or invalid crap, so pass to the REST parser
|
||||||
{
|
responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
|
||||||
responseString = AdminPage;
|
response.AddHeader("Content-type", "text/html");
|
||||||
response.AddHeader("Content-type", "text/html");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// must be REST or invalid crap, so pass to the REST parser
|
|
||||||
responseString = ParseREST(requestBody, request.RawUrl, request.HttpMethod);
|
|
||||||
response.AddHeader("Content-type", "text/html");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -280,52 +209,6 @@ namespace OpenSim.CAPS
|
||||||
output.Write(buffer, 0, buffer.Length);
|
output.Write(buffer, 0, buffer.Length);
|
||||||
output.Close();
|
output.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadAdminPage()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
StreamReader SR;
|
|
||||||
string lines;
|
|
||||||
AdminPage = "";
|
|
||||||
NewAccountForm = "";
|
|
||||||
LoginForm = "";
|
|
||||||
SR = File.OpenText("testadmin.htm");
|
|
||||||
|
|
||||||
while (!SR.EndOfStream)
|
|
||||||
{
|
|
||||||
lines = SR.ReadLine();
|
|
||||||
AdminPage += lines + "\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
SR.Close();
|
|
||||||
|
|
||||||
SR = File.OpenText("newaccountform.htm");
|
|
||||||
|
|
||||||
while (!SR.EndOfStream)
|
|
||||||
{
|
|
||||||
lines = SR.ReadLine();
|
|
||||||
NewAccountForm += lines + "\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
SR.Close();
|
|
||||||
|
|
||||||
SR = File.OpenText("login.htm");
|
|
||||||
|
|
||||||
while (!SR.EndOfStream)
|
|
||||||
{
|
|
||||||
lines = SR.ReadLine();
|
|
||||||
LoginForm += lines + "\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
SR.Close();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectType>Local</ProjectType>
|
<ProjectType>Local</ProjectType>
|
||||||
<ProductVersion>8.0.50727</ProductVersion>
|
<ProductVersion>8.0.50727</ProductVersion>
|
||||||
|
@ -6,7 +6,8 @@
|
||||||
<ProjectGuid>{4171D545-81F5-4C64-AD29-6D7414C38181}</ProjectGuid>
|
<ProjectGuid>{4171D545-81F5-4C64-AD29-6D7414C38181}</ProjectGuid>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ApplicationIcon></ApplicationIcon>
|
<ApplicationIcon>
|
||||||
|
</ApplicationIcon>
|
||||||
<AssemblyKeyContainerName>
|
<AssemblyKeyContainerName>
|
||||||
</AssemblyKeyContainerName>
|
</AssemblyKeyContainerName>
|
||||||
<AssemblyName>OpenSim.RegionServer</AssemblyName>
|
<AssemblyName>OpenSim.RegionServer</AssemblyName>
|
||||||
|
@ -15,9 +16,11 @@
|
||||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
<DelaySign>false</DelaySign>
|
<DelaySign>false</DelaySign>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder></AppDesignerFolder>
|
<AppDesignerFolder>
|
||||||
|
</AppDesignerFolder>
|
||||||
<RootNamespace>OpenSim.RegionServer</RootNamespace>
|
<RootNamespace>OpenSim.RegionServer</RootNamespace>
|
||||||
<StartupObject></StartupObject>
|
<StartupObject>
|
||||||
|
</StartupObject>
|
||||||
<FileUpgradeFlags>
|
<FileUpgradeFlags>
|
||||||
</FileUpgradeFlags>
|
</FileUpgradeFlags>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -28,7 +31,8 @@
|
||||||
<ConfigurationOverrideFile>
|
<ConfigurationOverrideFile>
|
||||||
</ConfigurationOverrideFile>
|
</ConfigurationOverrideFile>
|
||||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
<DocumentationFile></DocumentationFile>
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
<DebugSymbols>True</DebugSymbols>
|
<DebugSymbols>True</DebugSymbols>
|
||||||
<FileAlignment>4096</FileAlignment>
|
<FileAlignment>4096</FileAlignment>
|
||||||
<Optimize>False</Optimize>
|
<Optimize>False</Optimize>
|
||||||
|
@ -37,7 +41,8 @@
|
||||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn></NoWarn>
|
<NoWarn>
|
||||||
|
</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||||
|
@ -46,7 +51,8 @@
|
||||||
<ConfigurationOverrideFile>
|
<ConfigurationOverrideFile>
|
||||||
</ConfigurationOverrideFile>
|
</ConfigurationOverrideFile>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
<DocumentationFile></DocumentationFile>
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
<DebugSymbols>False</DebugSymbols>
|
<DebugSymbols>False</DebugSymbols>
|
||||||
<FileAlignment>4096</FileAlignment>
|
<FileAlignment>4096</FileAlignment>
|
||||||
<Optimize>True</Optimize>
|
<Optimize>True</Optimize>
|
||||||
|
@ -55,26 +61,28 @@
|
||||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<NoWarn></NoWarn>
|
<NoWarn>
|
||||||
|
</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" >
|
<Reference Include="System">
|
||||||
<HintPath>System.dll</HintPath>
|
<HintPath>System.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml" >
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml">
|
||||||
<HintPath>System.Xml.dll</HintPath>
|
<HintPath>System.Xml.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="libsecondlife.dll" >
|
<Reference Include="libsecondlife.dll">
|
||||||
<HintPath>..\bin\libsecondlife.dll</HintPath>
|
<HintPath>..\bin\libsecondlife.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Axiom.MathLib.dll" >
|
<Reference Include="Axiom.MathLib.dll">
|
||||||
<HintPath>..\bin\Axiom.MathLib.dll</HintPath>
|
<HintPath>..\bin\Axiom.MathLib.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Db4objects.Db4o.dll" >
|
<Reference Include="Db4objects.Db4o.dll">
|
||||||
<HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
|
<HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -84,25 +92,27 @@
|
||||||
<Name>OpenSim.Framework.Console</Name>
|
<Name>OpenSim.Framework.Console</Name>
|
||||||
<Project>{7AED7536-7D6B-4E28-8016-B5A554C663B4}</Project>
|
<Project>{7AED7536-7D6B-4E28-8016-B5A554C663B4}</Project>
|
||||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
|
<ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj">
|
||||||
<Name>OpenSim.Physics.Manager</Name>
|
<Name>OpenSim.Physics.Manager</Name>
|
||||||
<Project>{0AAA0EEB-1F2C-4B4B-9BFA-7C3E45BCD348}</Project>
|
<Project>{0AAA0EEB-1F2C-4B4B-9BFA-7C3E45BCD348}</Project>
|
||||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
|
<ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
|
||||||
<Name>OpenSim.Framework</Name>
|
<Name>OpenSim.Framework</Name>
|
||||||
<Project>{90D4F7AF-D75E-4DE8-A0E1-70CC242B31A1}</Project>
|
<Project>{90D4F7AF-D75E-4DE8-A0E1-70CC242B31A1}</Project>
|
||||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AgentAssetUpload.cs">
|
<Compile Include="AgentAssetUpload.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="CAPS\AdminWebFront.cs" />
|
||||||
|
<Compile Include="CAPS\IRestHandler.cs" />
|
||||||
<Compile Include="ConsoleCmds.cs">
|
<Compile Include="ConsoleCmds.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -183,4 +193,4 @@
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -23,6 +23,8 @@
|
||||||
<include name="VersionInfo.cs" />
|
<include name="VersionInfo.cs" />
|
||||||
<include name="Assets/AssetCache.cs" />
|
<include name="Assets/AssetCache.cs" />
|
||||||
<include name="Assets/InventoryCache.cs" />
|
<include name="Assets/InventoryCache.cs" />
|
||||||
|
<include name="CAPS/AdminWebFront.cs" />
|
||||||
|
<include name="CAPS/IRestHandler.cs" />
|
||||||
<include name="CAPS/SimHttp.cs" />
|
<include name="CAPS/SimHttp.cs" />
|
||||||
<include name="types/Mesh.cs" />
|
<include name="types/Mesh.cs" />
|
||||||
<include name="types/Triangle.cs" />
|
<include name="types/Triangle.cs" />
|
||||||
|
|
|
@ -114,6 +114,7 @@ namespace OpenSim
|
||||||
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting CAPS HTTP server");
|
||||||
OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer();
|
OpenSimRoot.Instance.HttpServer = new SimCAPSHTTPServer();
|
||||||
|
OpenSimRoot.Instance.HttpServer.AddRestHandler("Admin", new AdminWebFront("Admin"));
|
||||||
|
|
||||||
timer1.Enabled = true;
|
timer1.Enabled = true;
|
||||||
timer1.Interval = 100;
|
timer1.Interval = 100;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<form action="javascript:setpass();" name="logon" id="logon">
|
<form action="javascript:setpass();" name="logon" id="logon">
|
||||||
<p> Admin PassWord: <input type="password" id="Adminpss" size="17" maxlength="34"> </P>
|
<p> Admin Password: <input type="password" id="Adminpss" size="17" maxlength="34"> </P>
|
||||||
<input type="button" name="button" value="Login"
|
<input type="button" name="button" value="Login"
|
||||||
onclick="javascript:setpass(this.parentNode);">
|
onclick="javascript:setpass(this.parentNode);">
|
||||||
</form>
|
</form>
|
Loading…
Reference in New Issue