Exemplo n.º 1
0
        public async Task <bool> BlazorAppRessources()
        {
            try
            {
                //This is a request validation mecanism for the missing behavior of Navigating event when
                //navigating through an iframe. We must ensure that this behavior is concistent on each
                //platforms.
                string webextensionId = this.Request.Headers.Get("BlazorMobile-Validator");
                if (!string.IsNullOrEmpty(webextensionId))
                {
                    return(await ValidateRequestAndroid(webextensionId));
                }
                else if (this.Request.Url.AbsolutePath.Equals(MetadataConsts.ElectronBlazorMobileRequestValidationPath, StringComparison.OrdinalIgnoreCase))
                {
                    return(await ValidateRequestElectronWASM());
                }
                else
                {
                    //Standard behavior, serving Blazor app files and content
                    IWebResponse response = new EmbedIOWebResponse(this.Request, this.Response);
                    await WebApplicationFactory.ManageRequest(response);

                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(this.JsonExceptionResponse(ex));
            }
        }
Exemplo n.º 2
0
        public async Task <bool> BlazorAppRessources()
        {
            try
            {
                //This is a request validation mecanism for the missing behavior of Navigating event when
                //navigating through an iframe. We must ensure that this behavior is concistent on each
                //platforms.
                string webextensionId = this.Request.Headers.Get("BlazorMobile-Validator");
                if (!string.IsNullOrEmpty(webextensionId))
                {
                    return(await ValidateRequest(webextensionId));
                }
                else
                {
                    //Standard behavior, serving Blazor app files and content
                    IWebResponse response = new EmbedIOWebResponse(this.Request, this.Response);
                    await WebApplicationFactory.ManageRequest(response);

                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(this.JsonExceptionResponse(ex));
            }
        }
Exemplo n.º 3
0
        public override WebResourceResponse ShouldInterceptRequest(Android.Webkit.WebView view, IWebResourceRequest request)
        {
            if (!ShouldManageUrl(request))
            {
                return(base.ShouldInterceptRequest(view, request));
            }

            var response = new AndroidWebResponse(request);

            //Common management method
            WebApplicationFactory.ManageRequest(response);
            return(response.GetWebResourceResponse());
        }
Exemplo n.º 4
0
        public async Task <bool> BlazorAppRessources()
        {
            try
            {
                IWebResponse response = new EmbedIOWebResponse(this.Request, this.Response);
                await WebApplicationFactory.ManageRequest(response);

                return(true);
            }
            catch (Exception ex)
            {
                return(this.JsonExceptionResponse(ex));
            }
        }