move some region base handlers to simpleStreamHandler
parent
80de74e127
commit
ee77a6d80b
|
@ -829,19 +829,14 @@ namespace OpenSim
|
|||
/// <remarks>
|
||||
/// Currently this is always OK if the simulator is still listening for connections on its HTTP service
|
||||
/// </remarks>
|
||||
public class SimStatusHandler : BaseStreamHandler
|
||||
public class SimStatusHandler : SimpleStreamHandler
|
||||
{
|
||||
public SimStatusHandler() : base("GET", "/simstatus", "SimStatus", "Simulator Status") {}
|
||||
public SimStatusHandler() : base("/simstatus", "SimStatus", "Simulator Status") {}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes("OK");
|
||||
}
|
||||
|
||||
public override string ContentType
|
||||
{
|
||||
get { return "text/plain"; }
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes("OK");
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -849,25 +844,27 @@ namespace OpenSim
|
|||
/// Handler to supply the current extended status of this sim
|
||||
/// Sends the statistical data in a json serialization
|
||||
/// </summary>
|
||||
public class XSimStatusHandler : BaseStreamHandler
|
||||
public class XSimStatusHandler : SimpleStreamHandler
|
||||
{
|
||||
OpenSimBase m_opensim;
|
||||
|
||||
public XSimStatusHandler(OpenSimBase sim)
|
||||
: base("GET", "/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus")
|
||||
: base("/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus")
|
||||
{
|
||||
m_opensim = sim;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
try
|
||||
{
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
public override string ContentType
|
||||
catch
|
||||
{
|
||||
get { return "text/plain"; }
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -877,45 +874,46 @@ namespace OpenSim
|
|||
/// If the request contains a key, "callback" the response will be wrappend in the
|
||||
/// associated value for jsonp used with ajax/javascript
|
||||
/// </summary>
|
||||
protected class UXSimStatusHandler : BaseStreamHandler
|
||||
protected class UXSimStatusHandler : SimpleStreamHandler
|
||||
{
|
||||
OpenSimBase m_opensim;
|
||||
|
||||
public UXSimStatusHandler(OpenSimBase sim)
|
||||
: base("GET", "/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus")
|
||||
: base("/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus")
|
||||
{
|
||||
m_opensim = sim;
|
||||
}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
try
|
||||
{
|
||||
httpResponse.RawBuffer = Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
}
|
||||
|
||||
public override string ContentType
|
||||
catch
|
||||
{
|
||||
get { return "text/plain"; }
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// handler to supply serving http://domainname:port/robots.txt
|
||||
/// </summary>
|
||||
public class SimRobotsHandler : BaseStreamHandler
|
||||
public class SimRobotsHandler : SimpleStreamHandler
|
||||
{
|
||||
public SimRobotsHandler() : base("GET", "/robots.txt", "SimRobots.txt", "Simulator Robots.txt") {}
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
private readonly byte[] binmsg;
|
||||
public SimRobotsHandler() : base("/robots.txt", "SimRobots.txt", "Simulator Robots.txt")
|
||||
{
|
||||
string robots = "# go away\nUser-agent: *\nDisallow: /\n";
|
||||
return Util.UTF8.GetBytes(robots);
|
||||
binmsg = Util.UTF8.GetBytes("# go away\nUser-agent: *\nDisallow: /\n");
|
||||
}
|
||||
|
||||
public override string ContentType
|
||||
protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
get { return "text/plain"; }
|
||||
httpResponse.RawBuffer = binmsg;
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue