change SimpleStreamHandler to have a processor method argument
parent
46162e620a
commit
426d83c535
|
@ -97,6 +97,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// </summary>
|
||||
/// <param name="handler"></param>
|
||||
void AddStreamHandler(IRequestHandler handler);
|
||||
void AddSimpleStreamHandler(ISimpleStreamHandler handler);
|
||||
|
||||
bool AddXmlRPCHandler(string method, XmlRpcMethod handler);
|
||||
bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive);
|
||||
|
@ -141,6 +142,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
bool RemoveLLSDHandler(string path, LLSDMethod handler);
|
||||
|
||||
void RemoveStreamHandler(string httpMethod, string path);
|
||||
void RemoveSimpleStreamHandler(string path);
|
||||
|
||||
void RemoveXmlRPCHandler(string method);
|
||||
|
||||
|
|
|
@ -101,4 +101,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
// Handle request stream, return byte array
|
||||
void Handle(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
}
|
||||
|
||||
public delegate void SimpleStreamMethod(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse);
|
||||
}
|
|
@ -38,25 +38,36 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
/// <remarks>
|
||||
/// Inheriting classes should override ProcessRequest() rather than Handle()
|
||||
/// </remarks>
|
||||
public abstract class SimpleStreamHandler : SimpleBaseRequestHandler, ISimpleStreamHandler
|
||||
public class SimpleStreamHandler : SimpleBaseRequestHandler, ISimpleStreamHandler
|
||||
{
|
||||
protected IServiceAuth m_Auth;
|
||||
protected SimpleStreamMethod m_processRequest;
|
||||
|
||||
protected SimpleStreamHandler(string path) : this(path, null, null) { }
|
||||
public SimpleStreamHandler(string path) : base(path, null, null) { }
|
||||
public SimpleStreamHandler(string path, string name, string description) : base(path, name, description) { }
|
||||
|
||||
protected SimpleStreamHandler(string path, string name, string description)
|
||||
: base(path, name, description) { }
|
||||
public SimpleStreamHandler(string path, SimpleStreamMethod processRequest) : base(path, null, null)
|
||||
{
|
||||
m_processRequest = processRequest;
|
||||
}
|
||||
|
||||
protected SimpleStreamHandler(string path, IServiceAuth auth)
|
||||
: base(path, null, null)
|
||||
public SimpleStreamHandler(string path, IServiceAuth auth) : base(path, null, null)
|
||||
{
|
||||
m_Auth = auth;
|
||||
}
|
||||
|
||||
protected SimpleStreamHandler(string path, IServiceAuth auth, string name, string description)
|
||||
public SimpleStreamHandler(string path, IServiceAuth auth, SimpleStreamMethod processRequest)
|
||||
: base(path, null, null)
|
||||
{
|
||||
m_Auth = auth;
|
||||
m_processRequest = processRequest;
|
||||
}
|
||||
|
||||
public SimpleStreamHandler(string path, IServiceAuth auth, SimpleStreamMethod processRequest, string name, string description)
|
||||
: base(path, name, description)
|
||||
{
|
||||
m_Auth = auth;
|
||||
m_processRequest = processRequest;
|
||||
}
|
||||
|
||||
public virtual void Handle(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
|
@ -73,7 +84,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(m_processRequest != null)
|
||||
m_processRequest(httpRequest, httpResponse);
|
||||
else
|
||||
ProcessRequest(httpRequest, httpResponse);
|
||||
RequestsHandled++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue