protected override void ProcessRequest() { Destination destination = null; string destinationId; string s = base.Request.QueryString["source"]; if (!StringUtils.IsNullOrEmpty(s)) { destinationId = this.MessageBroker.GetDestinationId(s); destination = this.MessageBroker.GetDestination(destinationId); } else { destinationId = base.Request.QueryString["destination"]; if (!StringUtils.IsNullOrEmpty(destinationId)) { destination = this.MessageBroker.GetDestination(destinationId); s = destination.Source; } } FactoryInstance factoryInstance = destination.GetFactoryInstance(); factoryInstance.Source = s; Type instanceClass = factoryInstance.GetInstanceClass(); if (instanceClass != null) { ServiceClass service = JsonRpcServiceReflector.FromType(instanceClass); this.UpdateLastModifiedTime(instanceClass); if (!this.Modified()) { base.Response.StatusCode = 0x130; } else { if (this._lastModifiedTime != DateTime.MinValue) { base.Response.Cache.SetCacheability(HttpCacheability.Public); base.Response.Cache.SetLastModified(this._lastModifiedTime); } base.Response.ContentType = "text/javascript"; string str3 = service.Name + "Proxy.js"; base.Response.AppendHeader("Content-Disposition", "attachment; filename=" + str3); string key = "default"; if (!StringUtils.IsNullOrEmpty(base.Request.QueryString["generator"])) { key = base.Request.QueryString["generator"]; } if (this._generators.Contains(key)) { (this._generators[key] as IJsonRpcProxyGenerator).WriteProxy(service, new IndentedTextWriter(base.Response.Output), base.Request); } else if (log.get_IsErrorEnabled()) { log.Error(string.Format("JsonRpcGenerator {0} was not found", key)); } } } }
protected override void ProcessRequest() { Destination destination = null; string source = this.Request.QueryString["source"]; if (!StringUtils.IsNullOrEmpty(source)) { string destinationId = this.MessageBroker.GetDestinationId(source); destination = this.MessageBroker.GetDestination(destinationId); } else { string destinationId = this.Request.QueryString["destination"]; if (!StringUtils.IsNullOrEmpty(destinationId)) { destination = this.MessageBroker.GetDestination(destinationId); source = destination.Source; } } Type type; FactoryInstance factoryInstance = destination.GetFactoryInstance(); lock (factoryInstance) { factoryInstance.Source = source; type = factoryInstance.GetInstanceClass(); } if (type != null) { ServiceClass serviceClass = JsonRpcServiceReflector.FromType(type); UpdateLastModifiedTime(type); if (!Modified()) { this.Response.StatusCode = 304; return; } if (_lastModifiedTime != DateTime.MinValue) { this.Response.Cache.SetCacheability(HttpCacheability.Public); this.Response.Cache.SetLastModified(_lastModifiedTime); } Response.ContentType = "text/javascript"; string clientFileName = serviceClass.Name + "Proxy.js"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + clientFileName); //WriteProxy(serviceClass, new IndentedTextWriter(Response.Output)); string generatorName = "default"; if (!StringUtils.IsNullOrEmpty(this.Request.QueryString["generator"])) { generatorName = this.Request.QueryString["generator"]; } if (_generators.Contains(generatorName)) { IJsonRpcProxyGenerator generator = _generators[generatorName] as IJsonRpcProxyGenerator; generator.WriteProxy(serviceClass, new IndentedTextWriter(Response.Output), this.Request); } else { if (log.IsErrorEnabled) { log.Error(string.Format("JsonRpcGenerator {0} was not found", generatorName)); } } } }