Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebView with custom HTTP client

My task is to load web site in WebView over HTTPS with unsupported by vanilla Android TLS cipher. Right now as proof of concept I have implemented apache http client capable of doing http requests to such resources.

What is the best approach to make WebView use my custom client implementation to do all network requests?

like image 848
Sokolov Avatar asked Jul 18 '13 08:07

Sokolov


1 Answers

Actually, the accepted answer is wrong. You do not get full information; what's missing are request bodies.

So you can implement GET or HEAD requests just fine, but POST requests are trickier.

I haven't seen a good solution for that yet. One I've come across uses JavaScript inserted into the page to collect the POST data, hand it to Java via a binding https://developer.android.com/guide/webapps/webview.html#BindingJavaScript and then performs the request in Java.

Unfortunately, the WebView will try to perform the same request again, so you need to add more hackery to make it work.

like image 154
Jens Finkhaeuser Avatar answered Sep 30 '22 22:09

Jens Finkhaeuser