Making part of HttpClient behave like WebView

by Matthew1471 » Thu, 03 Mar 2011 04:27:48 GMT


Sponsored Links
 Hello!

I observe the web-browser allows you to view dodgy SSL certificates
(and cancel/ignore) for https sites that self sign. The built-in HTC
Mail application provides similar functionality when you use IMAPS.

So after downloading the browser (and then webkit) source from git I
have found all the bits I would want to implement in my HttpClient
based program:

CallbackProxy.java:
...case SSL_ERROR:
                ...
                    mWebViewClient.onReceivedSslError(mWebView,
                            (SslErrorHandler) map.get("handler"),
                            (SslError) map.get("error"));
                ...


and

...public void onReceivedSslError(SslErrorHandler handler, SslError
error) {
        ...
        if (mWebViewClient == null) {
            handler.cancel();
            return;
        }
        ....
    }...

Where handler.cancel() stops the site from running and
handler.proceed() allows it to continue (SslError contains both the
error and certificate that caused it).

How can I make the *Apache HttpClient* pass an event that allows the
user to view the certificate and ignore or continue (with the view to
databasing any allowed exceptions). Surely WebKit uses the HttpClient
behind the scenes so a method to register for call-back events such as
onRecievedSslError must exist?

I know, yes, you can implement your own trustedstore (I want my users
to connect to their own servers) or even your own SSLSocketFactory (to
over-ride checkServerTrusted etc) I do not feel brave enough to want
to do that, I would rather let the phone decide it is invalid and then
let the user over-ride it rather than forget to implement a crucial
check and risk making the SSL completely pointless.

Any help on how to get the HttpClient into that handler.cancel or
handler.proceed state would be much appreciated.

Thanks for your time,
Matthew

-- 



Other Threads

1. How to return Typeface from Cursor

I want to make a contentprovider for font file.
But I can not find any way to return a Typeface from Cursor. According
to SDK reference, MatrixCursor sounds like a solution, but it doesn't
support any object except String,Long,Double,Short,Flow.

Can anybody help me?

Best Regards
--~--~---------~--~----~------------~-------~--~----~

2. Does Android has JRMI installed?

HI.

I'd like to develop a commerce software, using android as client.
Does android support Java RMI to invoke J2EE EJB ?

I cannot find such doc from the SDK reference.
Could any one tell me the solution ?

Thanks a lot.


Freeman

-- 

3. IMPORTANT - display.getOrientation() does not work on all devices

4. Can two different activities that extend the same superclass have the same view ids?

5. A trouble about adding SDK component in Eclipse

6. NEEDED: Apps to feature on Sprint Microsite

7. How will dev phone be able to run Eclair?