On Mon, Mar 25, 2013 at 10:02 AM, Brett Delle Grazie <
brett.dellegra...@gmail.com> wrote:

> On 25 March 2013 13:00, Thad Humphries <thad.humphr...@gmail.com> wrote:
>
> > On Sun, Mar 24, 2013 at 4:46 PM, Konstantin Kolinko
> > <knst.koli...@gmail.com>wrote:
> >
> > > 2013/3/25 Thad Humphries <thad.humphr...@gmail.com>:
> > > > I have a web-app that uses a servlet for downloading files from a
> > > > repository--PDF, Office, images, zip, etc. It works with desktop
> > > > browsers--IE, Firefox, Chrome, and Safari--on their various
> platforms.
> > It
> > > > also works fine with Firefox from Android (2.3 and 4.x tested).
> However
> > > > when I try with Android's default WebKit browser, the servlet fails
> > > > immediately with org.apache.catalina.connector.ClientAbortException
> (so
> > > > says the stderr log).
> > >
> > > 1. Is this issue specific to some kind of files, or it occurs with all
> of
> > > them?
> > >
> >
> > All of them--PDF, XLS, DOC, DOCX, TIFF, ZIP, etc. Every file type I've
> > tried.
> >
> >
> > > 2. If client aborts a connection, there is nothing much a server can
> > > do. It is issue in your web browser.
> > >
> >
> > Yeah, I suspected that.
> >
> >
> > > > The servlet is sending proper headers, including the correct MIME
> type,
> > > > Content-Disposition attachment, file size, etc. I even took to adding
> > the
> > > > file's name as the last GET parameter. No dice.
> > >
> > > 3. Maybe the browser does not like "Content-Disposition attachment"?
> > > Maybe it cannot save the file?
> > >
> >
> > These same file types can be downloaded if the servlet is called by
> > Firefox, or if the file is requested from a directory listing or in an
> > email attachment. In these cases, with Android they go to the Downloads
> > directory on the memory card; on iPad, DOCs open in Pages, PDFs in a
> > viewer, etc.
> >
> >
> > > 4. Does it depend on file size? How the file is served? (What
> > > connector implementation are you using? Do you use compression, do you
> > > use sendfile?)
> > >
> >
> > Size does not matter, a few K or a several hundred K.
> >
> > > Safari on iPad, iPhone, and iPod Touch also fail. Although I don't have
> > > one
> > > > with me at this moment to test, I suspect their failure is also
> caused
> > > by a
> > > > ClientAbortException: Safari is also WebKit and *I've Google'd
> numerous
> > > > complaints about this exception when using mobile WebKit browsers*.
> > > While I
> > > > can tell Android users to try Firefox, there is no Firefox for
> iPhone.
> > > >
> > > > I'm expecting a file to open in a local viewer app, like Acrobat
> > Reader,
> > > > QuickOffice, Pages, etc. I can open files in these apps via Firefox,
> an
> > > > email client, or via the WebKit browser when viewing a directory
> > listing
> > > in
> > > > my public_html directories and similar locations.
> > > >
> > > > I suspect this is a problem with mobile WebKit, and that
> circumventing
> > > the
> > > > abort might be a "bad thing" even if it's possible. However I thought
> > I'd
> > > > inquire here if there is a Tomcat way around it. If not, it seems my
> > > > alternatives are (1) use Java Mail to mail the user the file, since
> > mail
> > > > apps open their attachments; and (2) write iOS and Android apps file
> > > query
> > > > and downloading. Neither prospect thrills me.
> >
>
> Is this over HTTPS or standard HTTP?


Standard HTTP.

The servlet opens the file from the repository using the repository's API,
sends the HTTP header, then reads the file (again with the API) and sends
the bytes to ServletOutputStream. The file is read and written in blocks
of response.getBufferSize() or 8K if that call returns zero.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, *Doctor Faustus* (v, 121-24)

Reply via email to