public BridgeContext(BridgeRequest request, string bridgeUrl) {
     if (request == null) {
         throw new ArgumentNullException("request");
     }
     _request = request;
     _bridgeUrl = bridgeUrl;
 }
Ejemplo n.º 2
0
        // Entrypoint to the pipeline
        protected virtual void ExecuteBridgePipeline()
        {
            // Make the calls to all other bridge methods first
            BridgeMethodInfo methodInfo = GetMethodInfoForCall(BridgeRequest.Method);

            foreach (BridgeChainRequestInfo callInfo in methodInfo.BridgeChainRequests)
            {
                Dictionary <string, object> args = new Dictionary <string, object>();
                ResolveParameters(callInfo.Parameters, args, Context);
                BridgeRequest request = new BridgeRequest(callInfo.Method, args);
                object        results = BridgeHandler.Invoke(callInfo.BridgeUrl, request);
                Context.ResultsChain[callInfo.Name] = results;
            }

            TransformRequest();

            // Stop execution if we have a cache hit
            if (ResolveRequestCache())
            {
                return;
            }

            ProcessRequest();
            TransformResponse();
            UpdateResponseCache();
        }
Ejemplo n.º 3
0
 public BridgeContext(BridgeRequest request, string bridgeUrl)
 {
     if (request == null)
     {
         throw new ArgumentNullException("request");
     }
     _request   = request;
     _bridgeUrl = bridgeUrl;
 }
Ejemplo n.º 4
0
        public static object Invoke(string bridgeUrl, BridgeRequest request)
        {
            bridgeUrl = VirtualPathUtility.ToAbsolute(bridgeUrl);

            Type type = BuildManager.GetCompiledType(bridgeUrl);

            if (type == null || !typeof(BridgeHandler).IsAssignableFrom(type))
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, PreviewWeb.BridgeHandler_CannotLoad, bridgeUrl));
            }
            BridgeHandler bridge = Activator.CreateInstance(type) as BridgeHandler;

            if (bridge == null)
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, PreviewWeb.BridgeHandler_CannotCreate, bridgeUrl));
            }
            return(bridge.Invoke(request));
        }
Ejemplo n.º 5
0
 protected void BuildBridgeContext(string bridgePath, BridgeRequest request)
 {
     _context = new BridgeContext(request, bridgePath);
 }
Ejemplo n.º 6
0
 // Public invocation of the entry point
 public object Invoke(BridgeRequest request)
 {
     BuildBridgeContext(VirtualPath, request);
     ExecuteBridgePipeline();
     return(BridgeResponse.Response);
 }
 protected void BuildBridgeContext(string bridgePath, BridgeRequest request) {
     _context = new BridgeContext(request, bridgePath);
 }
        public static object Invoke(string bridgeUrl, BridgeRequest request) {
            bridgeUrl = VirtualPathUtility.ToAbsolute(bridgeUrl);

            Type type = BuildManager.GetCompiledType(bridgeUrl);
            if (type == null || !typeof(BridgeHandler).IsAssignableFrom(type)) {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, PreviewWeb.BridgeHandler_CannotLoad, bridgeUrl));
            }
            BridgeHandler bridge = Activator.CreateInstance(type) as BridgeHandler;
            if (bridge == null) {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, PreviewWeb.BridgeHandler_CannotCreate, bridgeUrl));
            }
            return bridge.Invoke(request);
        }
 // Public invocation of the entry point
 public object Invoke(BridgeRequest request) {
     BuildBridgeContext(VirtualPath, request);
     ExecuteBridgePipeline();
     return BridgeResponse.Response;
 }
        // Entrypoint to the pipeline
        protected virtual void ExecuteBridgePipeline() {
            // Make the calls to all other bridge methods first
            BridgeMethodInfo methodInfo = GetMethodInfoForCall(BridgeRequest.Method);
            foreach (BridgeChainRequestInfo callInfo in methodInfo.BridgeChainRequests) {
                Dictionary<string, object> args = new Dictionary<string, object>();
                ResolveParameters(callInfo.Parameters, args, Context);
                BridgeRequest request = new BridgeRequest(callInfo.Method, args);
                object results = BridgeHandler.Invoke(callInfo.BridgeUrl, request);
                Context.ResultsChain[callInfo.Name] = results;
            }

            TransformRequest();

            // Stop execution if we have a cache hit
            if (ResolveRequestCache()) return;

            ProcessRequest();
            TransformResponse();
            UpdateResponseCache();
        }