Making part of HttpClient behave like WebView

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

Sponsored Links

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: SSL_ERROR:
                            (SslErrorHandler) map.get("handler"),
                            (SslError) map.get("error"));


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

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,


Other Threads

1. Detecting which drawable folder was used.

Is there a way to detect whether a image was pulled from the folder
res/drawable or res/drawable-hdpi?

I am trying to save space and have a program that is using some hdpi
bitmaps and some mdpi bitmaps. When an image is placed in
drawable-hdpi it automatically replaces the mdpi version. I need to
know when this happens beacuse I am using bitamp.resize() to fix the
image sizes.

I have tried this --

        //resize art
                count = artBitmaps.length;
                for(int i = 0; i < count; i++){
                        if(artBitmaps[i] != null && artBitmaps[i].getDensity() 
!= getScreenDPI()){
                                newW = (int) (artBitmaps[i].getWidth() * 
                                newH = (int) (artBitmaps[i].getHeight() * 
                                artBitmaps[i] = resizeBitmap(artBitmaps[i], 
newW, newH);

The problem is that the getDensity() method (in the if statment after
the && ) returns the screen density and I need the original bitmap
density. This allays matched the screenDPI and returns false. I have a
lot of artwork and do not want to duplicate everything for every size
screen. I am trying to just create hdpi bitmaps for the ones that
don't look good when re-sized.

Joshua Frank


2. Can I use android:onClick and run my app on 1.5?


This feature is available only in Android 1.6, so no you cannot do
what you want.


3. Message.recycle() always causes exceptions..

4. Attributes represented by expresions

5. Can I use android:onClick and run my app on 1.5?

6. ACTION_APPWIDGET_PICK intent. Where is the intent filter?

7. ACTION_APPWIDGET_PICK intent. Where is the intent filter