mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
some changes to getassets module and handler
This commit is contained in:
@@ -77,7 +77,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
m_assetService = assService;
|
||||
}
|
||||
|
||||
public void Handle(OSHttpRequest req, OSHttpResponse response)
|
||||
public void Handle(OSHttpRequest req, OSHttpResponse response, string serviceURL = null)
|
||||
{
|
||||
response.ContentType = "text/plain";
|
||||
|
||||
@@ -122,11 +122,24 @@ namespace OpenSim.Capabilities.Handlers
|
||||
return;
|
||||
|
||||
AssetBase asset = m_assetService.Get(assetID.ToString());
|
||||
if(asset == null)
|
||||
if (asset == null)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(serviceURL))
|
||||
{
|
||||
// m_log.Warn("[GETASSET]: not found: " + query + " " + assetStr);
|
||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
|
||||
string newid = serviceURL + "/" + assetID.ToString();
|
||||
asset = m_assetService.Get(newid);
|
||||
if (asset == null)
|
||||
{
|
||||
// m_log.Warn("[GETASSET]: not found: " + query + " " + assetStr);
|
||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
// m_log.Warn("[GETASSET]: not found: " + query + " " + assetStr);
|
||||
response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return;
|
||||
}
|
||||
|
||||
if (asset.Type != (sbyte)type)
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private static int m_NumberScenes = 0;
|
||||
private static BlockingCollection<APollRequest> m_queue = new BlockingCollection<APollRequest>();
|
||||
private static object m_loadLock = new object();
|
||||
protected IUserManagement m_UserManagement = null;
|
||||
|
||||
private Dictionary<UUID, string> m_capsDictTexture = new Dictionary<UUID, string>();
|
||||
private Dictionary<UUID, string> m_capsDictGetMesh = new Dictionary<UUID, string>();
|
||||
@@ -156,6 +157,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_UserManagement == null)
|
||||
m_UserManagement = s.RequestModuleInterface<IUserManagement>();
|
||||
|
||||
s.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
s.EventManager.OnDeregisterCaps += DeregisterCaps;
|
||||
|
||||
@@ -232,10 +236,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private HashSet<UUID> dropedResponses = new HashSet<UUID>();
|
||||
|
||||
private Scene m_scene;
|
||||
public PollServiceAssetEventArgs(string uri, UUID pId, Scene scene) :
|
||||
private string m_hgassets = null;
|
||||
public PollServiceAssetEventArgs(string uri, UUID pId, Scene scene, string HGAssetSVC) :
|
||||
base(null, uri, null, null, null, null, pId, int.MaxValue)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_hgassets = HGAssetSVC;
|
||||
|
||||
HasEvents = (requestID, agentID) =>
|
||||
{
|
||||
@@ -355,7 +361,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
*/
|
||||
}
|
||||
OSHttpResponse response = new OSHttpResponse(requestinfo.request);
|
||||
m_getAssetHandler.Handle(requestinfo.request, response);
|
||||
m_getAssetHandler.Handle(requestinfo.request, response, m_hgassets);
|
||||
|
||||
lock(responses)
|
||||
{
|
||||
@@ -389,6 +395,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
protocol = "https";
|
||||
}
|
||||
|
||||
string hgassets = null;
|
||||
if(m_UserManagement != null)
|
||||
hgassets = m_UserManagement.GetUserServerURL(agentID, "AssetServerURI");
|
||||
|
||||
IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
|
||||
string baseURL = String.Format("{0}://{1}:{2}", protocol, hostName, port);
|
||||
|
||||
@@ -397,7 +407,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
string capUrl = "/" + UUID.Random();
|
||||
|
||||
// Register this as a poll service
|
||||
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene);
|
||||
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene, hgassets);
|
||||
|
||||
//args.Type = PollServiceEventArgs.EventType.Texture;
|
||||
MainServer.Instance.AddPollServiceHTTPHandler(args);
|
||||
@@ -418,7 +428,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
string capUrl = "/" + UUID.Random();
|
||||
|
||||
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene);
|
||||
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene, hgassets);
|
||||
//args.Type = PollServiceEventArgs.EventType.Mesh;
|
||||
MainServer.Instance.AddPollServiceHTTPHandler(args);
|
||||
|
||||
@@ -436,7 +446,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
string capUrl = "/" + UUID.Random();
|
||||
|
||||
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene);
|
||||
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene, hgassets);
|
||||
//args.Type = PollServiceEventArgs.EventType.Mesh2;
|
||||
MainServer.Instance.AddPollServiceHTTPHandler(args);
|
||||
|
||||
@@ -449,13 +459,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
else if (m_GetMesh2URL != string.Empty)
|
||||
caps.RegisterHandler("GetMesh2", m_GetMesh2URL);
|
||||
|
||||
|
||||
//ViewerAsset
|
||||
if (m_GetAssetURL == "localhost")
|
||||
{
|
||||
string capUrl = "/" + UUID.Random();
|
||||
|
||||
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene);
|
||||
PollServiceAssetEventArgs args = new PollServiceAssetEventArgs(capUrl, agentID, m_scene, hgassets);
|
||||
//args.Type = PollServiceEventArgs.EventType.Asset;
|
||||
MainServer.Instance.AddPollServiceHTTPHandler(args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user