I am experiencing some very puzzling and frustrating behavior from a
WebView.  The WebView exists as the only child of a LinearLayout- that
is, it fills the entire screen.  Viz-

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android" android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
  <WebView android:id="@+id/webview"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:drawSelectorOnTop="false"/>
</LinearLayout>

In the enclosing Activity's onCreate, I do like this:

  webview.loadData("<html>Try <a href='http://www.somehost.com/
documents/some-document.pdf'>this</a>", "text/html", "UTF-8");

The WebView renders that HTML fine.  When I click on the link, I can
see (through a debugging web proxy) that the WebView does an HTTP GET
for http://www.somehost.com/documents/some-document.pdf, like this:

GET /documents/some-document.pdf HTTP/1.1
Host: www.somehost.com
Accept-Encoding: gzip
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/
plain;q=0.8,image/png,*/*;q=0.5
User-Agent: Mozilla/5.0 (Linux; U; Android 1.5; en-us; sdk Build/
CUPCAKE) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile
Safari/525.20.1
Accept-Language: en-US
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7

and the server at somehost.com replies like this:

HTTP/1.1 200 OK
Date: Sat, 03 Oct 2009 23:51:59 GMT
Server: Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6
Last-Modified: Fri, 17 Apr 2009 04:58:28 GMT
ETag: "19d190-aab5-467b908050500"
Accept-Ranges: bytes
Content-Length: 43701
Content-Type: application/pdf

Then the server at somehost.com starts streaming the PDF data, as the
entity of the reply.  However, after it streams 10K or so of the data,
the client side socket (i.e.- the one controlled by the WebView code)
closes the socket prematurely.  The document referenced by the link is
not downloaded- the WebView simply stays on the original page.

Any idea why the Android-controlled socket it closes abruptly?  Is
there any way I can turn on some low-level socket debugging on Android
that I might be able to see logging output from via LogCat or
something?

Thanks in advance for any help!

Best Regards,

Danny



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to