regarding HTTPClient : How to get the HTTP request posted by the native browser

by Viju » Fri, 20 May 2011 09:34:00 GMT


Sponsored Links
 Hi,

Is it possible to get all the HTTP URL request triggered by the
browser (Apache) from my client application ? If then, can you please
tell me the framework API which gives me the URL ?

I'm developing some kinda of HTTP sniffer application for android
which will log all the HTTP Url request made by the native browser
(Apace) and store it in a local file.

-- 



Re: regarding HTTPClient : How to get the HTTP request posted by the native browser

by Jens » Fri, 20 May 2011 17:31:40 GMT


 Apache - as in the HttpClient, org.apache.http.* or the web server?
Further - the browser in the phone typically doesn't use the apache
HTTP client library, it's JNI to WebKit.

The good thing is that you're not going to be able to sniff either
without building your own firmware and flashing the phone.




-- 


Sponsored Links


Other Threads

1. Is there some package to send SMS on CDMA ?

Hi~

I heard that Android provides CDMA but I can`t find the fact on SDK
Documents.

Android provides GSM telephony package but CDMA telephony package is
nothing.


What can I use package to send SMS?

plz let me know.

thanks. ^^

--~--~---------~--~----~------------~-------~--~----~

2. When I try to use DefaultHttpClient to access https server via proxy, an IllegalArgumentException will be thrown, why?

Detail Descriptioin:
1. When I use the same code to access "http://www.google.com", it
works.
2. When I use the same code to access "https://www.google.com", it
doesn't work and will throw IllegalArgumentException.

Please help me to identify the issue, thank you!

Here is the code fragment:
...
DefaultHttpClient httpClient = new DefaultHttpClient();
httpClient.getCredentialsProvider().setCredentials(
                new AuthScope("<proxy host>", <proxy port>),
                null);
HttpHost proxy = new HttpHost("<proxy host>", <proxy port>);
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
proxy);
HttpGet httpGet = new HttpGet("https://www.google.com");
try {
    HttpResponse resp = httpClient.execute(httpGet);
    System.out.println(resp.getStatusLine().toString());
} catch(Exception e) {
    e.printStackTrace();
}
...

Here is the exception thrown:
java.lang.IllegalArgumentException
    at java.net.InetSocketAddress.<init>(InetSocketAddress.java:103)
    at java.net.InetSocketAddress.<init>(InetSocketAddress.java:94)
    at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.<init>
(OpenSSLSocketImpl.java:261)
    at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImplWrapper.<init>
(OpenSSLSocketImplWrapper.java:34)
    at
org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl.createSocket
(OpenSSLSocketFactoryImpl.java:83)
    at org.apache.http.conn.ssl.SSLSocketFactory.createSocket
(SSLSocketFactory.java:362)
    at
org.apache.http.impl.conn.DefaultClientConnectionOperator.updateSecureConnection
(DefaultClientConnectionOperator.java:176)
    at org.apache.http.impl.conn.AbstractPoolEntry.layerProtocol
(AbstractPoolEntry.java:302)
    at
org.apache.http.impl.conn.AbstractPooledConnAdapter.layerProtocol
(AbstractPooledConnAdapter.java:146)
    at
org.apache.http.impl.client.DefaultRequestDirector.establishRoute
(DefaultRequestDirector.java:623)
    at org.apache.http.impl.client.DefaultRequestDirector.execute
(DefaultRequestDirector.java:352)
    at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:555)
    at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:487)
    at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:465)
    at aaron.example.mytry.TryProxy.onCreate(TryProxy.java:65)
    at android.app.Instrumentation.callActivityOnCreate
(Instrumentation.java:1123)
    at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2114)
    at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2167)
    at android.app.ActivityThread.access$1800(ActivityThread.java:112)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1582)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3760)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:518)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:745)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:503)
    at dalvik.system.NativeStart.main(Native Method)

--~--~---------~--~----~------------~-------~--~----~

3. How to share apk

4. problem refreshing ArrayAdapter used for an auto completion

5. Inefficient of debugging.

6. How accurate is the rotation sensor?

7. How do I get the source code of Android 1.1_r1?