Welcome Guest Search | Active Topics | Sign In | Register

Custom resource handler ProcessRequest pass through Options
jason
Posted: Friday, May 3, 2019 12:10:19 AM
Rank: Newbie
Groups: Member

Joined: 4/28/2019
Posts: 5
Trying to intercept some XMLHttpRequest data (JSON string) but am having no luck.

Are there any other examples available that show how to use a custom resource handler to intercept response data but still allow this data to hit the webview controller and not block anything? I can't figure out how to do this based on the current example that loads a .htm page into the output stream.

I'm also able to make a request for this data using the JavaScript fetch() function but it doesn't seem to play well with EvalScript.
eo_support
Posted: Friday, May 3, 2019 2:01:31 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

Custom resource handler replaces the network layer and it is all or nothing ---- you either let the browser engine fetches the resource for you or you do it yourself. Once you do it yourself, it no longer has nothing to do with the browser engine.

I am not sure what you meant by "still allow this data to hit the WebView controller". What do you mean by "WebView controller"? The result of your custom resource handler is directly passed down to the WebView.

Thanks!
jason
Posted: Friday, May 3, 2019 2:39:52 PM
Rank: Newbie
Groups: Member

Joined: 4/28/2019
Posts: 5
eo_support wrote:
Hi,

Custom resource handler replaces the network layer and it is all or nothing ---- you either let the browser engine fetches the resource for you or you do it yourself. Once you do it yourself, it no longer has nothing to do with the browser engine.

I am not sure what you meant by "still allow this data to hit the WebView controller". What do you mean by "WebView controller"? The result of your custom resource handler is directly passed down to the WebView.

Thanks!


I think I see. So, if I'm interested in the response to a particular request and am using the resource handler in this way, I'll need to:

1. Intercept the request via Match
2. Send the request off at the network layer via System.Net.Http or something and collect that response myself
3. response.OutputStream.Write() the response so that it is passed down to the WebView

Hopefully I'm following correctly!

jason
Posted: Friday, May 3, 2019 4:18:43 PM
Rank: Newbie
Groups: Member

Joined: 4/28/2019
Posts: 5
Yup, that was it. Now everything is working as expected.
eo_support
Posted: Saturday, May 4, 2019 2:13:45 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Yes. You understood it correctly. Glad to hear that you got it working!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.