Java Mailing List Archive

http://www.junlu.com/

Home » users-digest.tomcat »

users Digest 25 Mar 2013 16:00:24 -0000 Issue 11314

users-digest-help

2013-03-25


Author LoginPost Reply

users Digest 25 Mar 2013 16:00:24 -0000 Issue 11314

Topics (messages 240710 through 240723)

IWA username using JSP for Already authenticated Window system
 240710 by: N.s.Karthik
 240714 by: Daniel Mikusa
 240718 by: N.s.Karthik
 240719 by: Daniel Mikusa

Re: [somewhat OT] runtime.exec "cmd.exe /C net use"
 240711 by: André Warnier

Re: runtime.exec "cmd.exe /C net use"
 240712 by: André Warnier
 240720 by: Patrick Flaherty
 240723 by: Harris, Jeffrey E.

Re: How to set environment variables for R to use in Tomcat on RedHat Linux (RHEL6)
 240713 by: Daniel Mikusa

Re: Can ClientAbortException be circumvented?
 240715 by: Thad Humphries
 240716 by: Brett Delle Grazie
 240717 by: Thad Humphries
 240721 by: Howard W. Smith, Jr.
 240722 by: Howard W. Smith, Jr.

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: users@(protected)
To unsubscribe, e-mail: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-digest-help@(protected)

----------------------------------------------------------------------


Attachment: users_240710.eml (zipped)
Hi

spec : O/s Linux -Oracle
       Jdk =1.6
       Tomcat = 7.0.30
       Browsers = IE8 Only
       
     * Pre authenticated Windows Clients via Active directory *
      Would use Integrated Window Authentication settings for Browsers



Question : Since All the Systems are pre authenticated in Window domain via
Active Directory during bootup process, and On request of a URL of web
application ( Tomcat7 served from linux) need to pass the username of the
system ?


Can some body help me for the solutions .....

with regards karthik




--
Sent from the Tomcat - User mailing list archive at Nabble.com.


Attachment: users_240714.eml (zipped)
On Mar 24, 2013, at 11:30 PM, N.s.Karthik wrote:

> Hi
>
> spec : O/s Linux -Oracle
>        Jdk =1.6
>        Tomcat = 7.0.30
>        Browsers = IE8 Only
>
>      * Pre authenticated Windows Clients via Active directory *
>       Would use Integrated Window Authentication settings for Browsers
>
>
>
> Question : Since All the Systems are pre authenticated in Window domain via
> Active Directory during bootup process, and On request of a URL of web
> application ( Tomcat7 served from linux) need to pass the username of the
> system ?

Have you read...

https://tomcat.apache.org/tomcat-7.0-doc/windows-auth-howto.html

Dan


>
> Can some body help me for the solutions .....
>
> with regards karthik
>
>
>
>
> --
> View this message in context: http://tomcat.10.n6.nabble.com/IWA-username-using-JSP-for-Already-authenticated-Window-system-tp4996846.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>



Attachment: users_240718.eml (zipped)
Hi

Thx for the Quick Reply

>>https://tomcat.apache.org/tomcat-7.0-doc/windows-auth-howto.html

I have already tried this and found the same to Work only on Windows
Environment

but my Tomcat servers are on Oracle Linux Systems...

Will this configurations work with "Tomcat 7.0.30 on Linux" with Clients
using IE8 from Windows ???


with regards
Karthik




--
Sent from the Tomcat - User mailing list archive at Nabble.com.


Attachment: users_240719.eml (zipped)
On Mar 25, 2013, at 10:47 AM, N.s.Karthik wrote:

> Hi
>
> Thx for the Quick Reply
>
>>> https://tomcat.apache.org/tomcat-7.0-doc/windows-auth-howto.html
>
> I have already tried this and found the same to Work only on Windows Environment

Tried what specifically? There are several suggestions for making this work at the above link.

>
> but my Tomcat servers are on Oracle Linux Systems...
>
> Will this configurations work with "Tomcat 7.0.30 on Linux" with Clients
> using IE8 from Windows ???

Again, you are going to need to be more specific on what configuration you are referring to.

Dan


>
>
> with regards
> Karthik
>
>
>
>
> --
> View this message in context: http://tomcat.10.n6.nabble.com/IWA-username-using-JSP-for-Already-authenticated-Window-system-tp4996846p4996896.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>



Attachment: users_240711.eml (zipped)
Howard W. Smith, Jr. wrote:
>> Hi Jeffrey,
>>
>> Yes, I now get it. Thanks for the lesson on Windows Networking (I thought
>> I knew well) and thanks to Andre as well.
>> You also said that if all I wanted to do was make a list of mapping appear
>> in an html page (without actually using them
>> in your application), you can just fake it as previously discussed. I
>> think I missed that part.
>>
>> Thanks
>> Pat
>>
>>
>>
> Glad you understand now. I was about to provide a response similar to
> Andre's previous response. This all reminds me of a similar situation
> within my TomEE/Tomcat7 web app.
>
> On my development server (Windows 2008 server 64-bit), I am 'always' logged
> in and coding/etc, which means I always test the web app via NetBeans
> (which provide the infamous 'console' that is mentioned throughout this
> thread). I developed this piece of code that uses JODConverter to call
> OpenOffice.org at/via port 2002, and this allows my web app to convert
> files to PDF after enduser uploads certain documents (Word docs, excel,
> etc...). So, that all works on my development server. Why? because I am
> logged in everytime while testing and the app is 'never' running as a
> Windows 'service' on my development server.
>
> So, i deploy my web app to target/production server (Windows 2003 Server
> and/or Windows Server 2008). For many months now, I have wondered 'why' the
> code will not work on the 'production' server but it runs/works 'everytime'
> on my development server. Finally, recently (after many months of research
> and/or multiple attempts of trying to debug/resolve the problem), I either
> read somewhere or finally realized that the code will 'not' work because my
> web app is running as a service, and for whatever reason (of course a
> 'Windows' reason), the code will 'not' work while running as a service.
>
> So, I am left to coding another implementation to convert files after
> upload, use another library, and ditch the JODConverter/OpenOffice.org
> approach.
>

Maybe of interest to you : I do use JODConverter+OpenOffice in the circumstances which you
describe (and for the same reason), within a perl program running as a Windows Service,
and it works fine. I don't think I have ever precisely done that on a Windows 2008
Server, but I do have that running on various other Windows platforms (Win2K, WinXP,
Windows-7, Windows 2003 server) since years, and have converted hundreds of thousands of
documents with it.
(A bit on the side : you may also want to have a look at LibreOffice, which does away with
the need of a JODConverter-like interface; but I do not know (yet) how good it is at
generating PDFs from MS-Office documents).

If I can help, we can continue this discussion off-list if you want.




Attachment: users_240712.eml (zipped)
Howard W. Smith, Jr. wrote:
> On Sun, Mar 24, 2013 at 7:14 PM, Howard W. Smith, Jr. <
> smithh032772@(protected):
>
>>
>>> Hi Jeffrey,
>>>
>>> Yes, I now get it. Thanks for the lesson on Windows Networking (I thought
>>> I knew well) and thanks to Andre as well.
>>> You also said that if all I wanted to do was make a list of mapping
>>> appear in an html page (without actually using them
>>> in your application), you can just fake it as previously discussed. I
>>> think I missed that part.
>>>
>>> Thanks
>>> Pat
>>>
>>>
>>>
>> Glad you understand now. I was about to provide a response similar to
>> Andre's previous response. This all reminds me of a similar situation
>> within my TomEE/Tomcat7 web app.
>>
>> On my development server (Windows 2008 server 64-bit), I am 'always'
>> logged in and coding/etc, which means I always test the web app via
>> NetBeans (which provide the infamous 'console' that is mentioned throughout
>> this thread). I developed this piece of code that uses JODConverter to call
>> OpenOffice.org at/via port 2002, and this allows my web app to convert
>> files to PDF after enduser uploads certain documents (Word docs, excel,
>> etc...). So, that all works on my development server. Why? because I am
>> logged in everytime while testing and the app is 'never' running as a
>> Windows 'service' on my development server.
>>
>> So, i deploy my web app to target/production server (Windows 2003 Server
>> and/or Windows Server 2008). For many months now, I have wondered 'why' the
>> code will not work on the 'production' server but it runs/works 'everytime'
>> on my development server. Finally, recently (after many months of research
>> and/or multiple attempts of trying to debug/resolve the problem), I either
>> read somewhere or finally realized that the code will 'not' work because my
>> web app is running as a service, and for whatever reason (of course a
>> 'Windows' reason), the code will 'not' work while running as a service.
>>
>> So, I am left to coding another implementation to convert files after
>> upload, use another library, and ditch the JODConverter/OpenOffice.org
>> approach.
>>
>>
> Forgot to mention... since OpenOffice.org can be installed in the Startup
> folder, i was assuming that it would run as a service on production server,
> and/but I forgot that Startup folder just automatically starts the app
> immediately when/after you login. OpenOffice.org is 'not' running as a
> service, and since my web app is running as a service (in a different
> 'environment'), my web app was unable to access OpenOffice.org, because
> clearly/definitely/evidently, it was not/never running as a 'service'..
> which means it was never available to my web app. :(
>

And, to get back more OT, that may be the fundamental difference with my succesful usage
of the same : in my case, it is my service program which launches the background
OpenOffice instance, which most probably means that it too is running in the same service
context a the main service program.
(Which brings us back to the same context as this thread).




Attachment: users_240720.eml (zipped)

On Mar 25, 2013, at 6:03 AM, André Warnier wrote:

> Howard W. Smith, Jr. wrote:
>> On Sun, Mar 24, 2013 at 7:14 PM, Howard W. Smith, Jr. <
>> smithh032772@(protected):
>>>
>>>> Hi Jeffrey,
>>>>
>>>> Yes, I now get it. Thanks for the lesson on Windows Networking (I
>>>> thought
>>>> I knew well) and thanks to Andre as well.
>>>> You also said that if all I wanted to do was make a list of mapping
>>>> appear in an html page (without actually using them
>>>> in your application), you can just fake it as previously
>>>> discussed. I
>>>> think I missed that part.
>>>>
>>>> Thanks
>>>> Pat
>>>>
>>>>
>>>>
>>> Glad you understand now. I was about to provide a response similar
>>> to
>>> Andre's previous response. This all reminds me of a similar
>>> situation
>>> within my TomEE/Tomcat7 web app.
>>>
>>> On my development server (Windows 2008 server 64-bit), I am 'always'
>>> logged in and coding/etc, which means I always test the web app via
>>> NetBeans (which provide the infamous 'console' that is mentioned
>>> throughout
>>> this thread). I developed this piece of code that uses
>>> JODConverter to call
>>> OpenOffice.org at/via port 2002, and this allows my web app to
>>> convert
>>> files to PDF after enduser uploads certain documents (Word docs,
>>> excel,
>>> etc...). So, that all works on my development server. Why? because
>>> I am
>>> logged in everytime while testing and the app is 'never' running
>>> as a
>>> Windows 'service' on my development server.
>>>
>>> So, i deploy my web app to target/production server (Windows 2003
>>> Server
>>> and/or Windows Server 2008). For many months now, I have wondered
>>> 'why' the
>>> code will not work on the 'production' server but it runs/works
>>> 'everytime'
>>> on my development server. Finally, recently (after many months of
>>> research
>>> and/or multiple attempts of trying to debug/resolve the problem),
>>> I either
>>> read somewhere or finally realized that the code will 'not' work
>>> because my
>>> web app is running as a service, and for whatever reason (of
>>> course a
>>> 'Windows' reason), the code will 'not' work while running as a
>>> service.
>>>
>>> So, I am left to coding another implementation to convert files
>>> after
>>> upload, use another library, and ditch the JODConverter/
>>> OpenOffice.org
>>> approach.
>>>
>>>
>> Forgot to mention... since OpenOffice.org can be installed in the
>> Startup
>> folder, i was assuming that it would run as a service on production
>> server,
>> and/but I forgot that Startup folder just automatically starts the
>> app
>> immediately when/after you login. OpenOffice.org is 'not' running
>> as a
>> service, and since my web app is running as a service (in a different
>> 'environment'), my web app was unable to access OpenOffice.org,
>> because
>> clearly/definitely/evidently, it was not/never running as a
>> 'service'..
>> which means it was never available to my web app. :(
>
> And, to get back more OT, that may be the fundamental difference
> with my succesful usage of the same : in my case, it is my service
> program which launches the background OpenOffice instance, which
> most probably means that it too is running in the same service
> context a the main service program.
> (Which brings us back to the same context as this thread).
Update: If I'm login interactively (meaning machine boots and I login
and get my desktop) and that interactive account matches the service
login account
then "net use" from within the service does return all mapped drives.
I'm not sure if that is by design or is something I can hang my hat on
but it is the case
with Windows 7 SP1.

Thanks again
Pat



>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>



Attachment: users_240723.eml (zipped)


> -----Original Message-----
> Update: If I'm login interactively (meaning machine boots and I login
> and get my desktop) and that interactive account matches the service
> login account then "net use" from within the service does return all
> mapped drives.
> I'm not sure if that is by design or is something I can hang my hat on
> but it is the case with Windows 7 SP1.
>
> Thanks again
> Pat
>
>
>

Interesting. It is possible that if you are already logged in, and start
the service, it does not need to log in separately as the service. Does this work
whether you start the service before or after you log in interactively
with the same account?

In any case, I am not sure you can rely on that because it does require an interactive
login, and if your system reboots in the middle of the night (whether because of an
unplanned event or installation of Microsoft updates, depending on your server is
configured), you will not be there to log in interactively so the net share list
is available, and you probably do not want to set automatic login for the account.

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.


Attachment: users_240713.eml (zipped)
On Mar 24, 2013, at 3:56 AM, Patrick Hong wrote:

> I'm trying to set up R and Tomcat on RHEL6 (6.4)
>
> I have installed R and can run it. I have installed Tomcat 7 and can host
> files file. I have packaged an application as a WAR file and deployed it
> using tomcat. The application runs fine in all aspects until it uses any R
> component.
>
> This is where it crashes out with the following error as seen in
> catalina.out:
>
> <code>
> Cannot find JRI native library!
> Please make sure that the JRI native library is in a directory listed in
> java.library.path.

I prefer setting "java.library.path" to setting "LD_LIBRARY_PATH", as the first is system independent. They should both work though.

>
> java.lang.UnsatisfiedLinkError:
> /usr/local/lib64/R-2.15.3/library/rJava/jri/libj
> ri.so: libR.so: cannot open shared object file: Too many levels of symbolic
> links

This error "Too many levels of symbolic links" usually happens when there is a problem with your symbolic links. For example, you have a link to a link which links to another link, etc… or when you have circular links.

A couple things you can do to debug further.

1.) Manually follow the symbolic links for "libR.so" (what it appears to be trying to load) using "ls".
2.) Use the "ldd" command ex: "ldd libR.so". Make sure ldd is able to locate all the required libraries.

> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0 (ClassLoader.java:1750)
> at java.lang.ClassLoader.loadLibrary (ClassLoader.java:1675)
> at java.lang.Runtime.loadLibrary0 (Runtime.java:840)
> at java.lang.System.loadLibrary (System.java:1047)
> at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
> </code>
>
> I do have rJava installed under R: install.packages("rJava") It installed
> fine and I have rJava inside the R's library folder.
>
> I have defined the following in /etc/profile:
>
> <code>
> export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
> export R_HOME=/usr/local/lib64/R-2.15.3
> PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$R_HOME/bin
> export PATH
> export
> LD_LIBRARY_PATH=$R_HOME/lib/libR.so,$JAVA_HOME/lib/amd64/server/libjvm.so

This looks wrong.

1.) Items specified by LD_LIBRARY_PATH should point to directories not shared libraries. Try using "$R_HOME/lib".

"In Linux, the environment variable LD_LIBRARY_PATH is a colon-separated set of directories where libraries should be searched for first, before the standard set of directories;"

http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

2.) Why are you including the path to "libjvm.so"? This is not something you would normally do.


> </code>
>
> To my understanding, that should set JAVA_HOME, R_HOME, PATH, and
> LD_LIBRARY_PATH globally for all users on the server. I know Tomcat runs
> under root and I can confirm that root was able to see all the above paths

Running Tomcat as root is a *really* bad idea. You should create a dedicated user with minimal permissions to run Tomcat. This will limit the scope of what an attacker could accomplish should he or she be able to compromise your system.

Dan


> as set above via "echo $JAVA_HOME", "echo $R_HOME", "echo $LD_LIBRARY_PATH",
> "echo $PATH"
>
> So I'm not sure why it's complaining that it can't open those .so files.
>
> Also, when it crashes out, it shuts down Tomcat.
>
> Thanks!
>
> Patrick
>
>
>



Attachment: users_240715.eml (zipped)
On Sun, Mar 24, 2013 at 4:46 PM, Konstantin Kolinko
<knst.kolinko@(protected):

> 2013/3/25 Thad Humphries <thad.humphries@(protected)>:
> > 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.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>


--
"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)

Attachment: users_240716.eml (zipped)
On 25 March 2013 13:00, Thad Humphries <thad.humphries@(protected):

> On Sun, Mar 24, 2013 at 4:46 PM, Konstantin Kolinko
> <knst.kolinko@(protected):
>
> > 2013/3/25 Thad Humphries <thad.humphries@(protected)>:
> > > 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?



> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@(protected)
> > For additional commands, e-mail: users-help@(protected)
> >
> >
>
>
> --
> "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)
>



--
Best Regards,

Brett Delle Grazie

Attachment: users_240717.eml (zipped)
On Mon, Mar 25, 2013 at 10:02 AM, Brett Delle Grazie <
brett.dellegrazie@(protected):

> On 25 March 2013 13:00, Thad Humphries <thad.humphries@(protected):
>
> > On Sun, Mar 24, 2013 at 4:46 PM, Konstantin Kolinko
> > <knst.kolinko@(protected):
> >
> > > 2013/3/25 Thad Humphries <thad.humphries@(protected)>:
> > > > 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)

Attachment: users_240721.eml (zipped)
On Mon, Mar 25, 2013 at 9:00 AM, Thad Humphries <thad.humphries@(protected):

> On Sun, Mar 24, 2013 at 4:46 PM, Konstantin Kolinko
> <knst.kolinko@(protected):
>
> > 2013/3/25 Thad Humphries <thad.humphries@(protected)>:
> > > 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.
>

Hmmm, interesting thread (and responses so far). I think I am aware of this
'Android default Webkit browser' you are referring to. I always avoid using
it, and download Google Chrome from Google Play store to my Android
devices, and I don't think I ever tested my web app with the default
browser installed on Android devices.

I have downloaded PDF files (generated in-memory) from my java/JSF web app
to Android device, and I have never seen this ClientAbortException. my web
app also has at least one iPad enduser (which has Google Chrome installed
on iPad). I am unaware of his experience and I don't think he downloads PDF
files from web app to his iPad, but I am quite confident that it works or
will work. :)

> >
>
> > 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.
>

Okay, i just tested this with/in my web app on my Google Nexus 7 (android,
of course). I offer Download, Print, and View hyperlinks within the web
app. Mind you, this is PrimeFaces xhtml below.

---download---
<p:commandLink value="Download" ajax="false"

actionListener="#{pf_ordersController.refreshContractsToDownload()}">
  <p:fileDownload value="#{contractToDownload.file}"/>
</p:commandLink>

Test and results:

clicked Download button, PDF downloaded to Google Nexus 7 (Google Chrome
browser, of course), showed up in notifications, instead of PDF Viewer app,
I selected to open the PDF document in Adobe Acrobat (app that was
downloaded from Google Play).

---view---
<h:commandLink value="View" target="_blank"

actionListener="#{pf_ordersController.refreshContractsToDownload()}">
  <p:fileDownload value="#{contractToDownload.file}"
            contentDisposition="inline"/>
</h:commandLink>

Test and results:

clicked View button, I saw another web page tab open rather quickly in the
Google Chrome browser on Google Nexus 7, and then the new tab closed
immediately, and then I saw the 'Starting download' toast (at bottom of
Google Nexus 7), but I didn't see the file in notifications or downloads,
and I didn't see any exceptions in my TomEE/tomcat7 logs.

With that said, maybe I just duplicated this issue/exception that you have
been experiencing. If I'm not mistaking, PrimeFaces is using the servlet
solution for file downloads.

So, based on this test of mine, it is best to offer a 'download' hyperlink
'only' on mobile devices as I am already detecting mobile devices when they
login to the web app.

Thanks for this topic. now I know what i 'need' to do. :)

Attachment: users_240722.eml (zipped)
On Mon, Mar 25, 2013 at 11:54 AM, Howard W. Smith, Jr. <
smithh032772@(protected):

> On Mon, Mar 25, 2013 at 9:00 AM, Thad Humphries <thad.humphries@(protected):
>
>> On Sun, Mar 24, 2013 at 4:46 PM, Konstantin Kolinko
>> <knst.kolinko@(protected):
>>
>> > 2013/3/25 Thad Humphries <thad.humphries@(protected)>:
>> > > 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.
>>
>
> Hmmm, interesting thread (and responses so far). I think I am aware of
> this 'Android default Webkit browser' you are referring to. I always avoid
> using it, and download Google Chrome from Google Play store to my Android
> devices, and I don't think I ever tested my web app with the default
> browser installed on Android devices.
>
> I have downloaded PDF files (generated in-memory) from my java/JSF web app
> to Android device, and I have never seen this ClientAbortException. my web
> app also has at least one iPad enduser (which has Google Chrome installed
> on iPad). I am unaware of his experience and I don't think he downloads PDF
> files from web app to his iPad, but I am quite confident that it works or
> will work. :)
>
> > >
>>
> > > 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.
>>
>
> Okay, i just tested this with/in my web app on my Google Nexus 7 (android,
> of course). I offer Download, Print, and View hyperlinks within the web
> app. Mind you, this is PrimeFaces xhtml below.
>
> ---download---
> <p:commandLink value="Download" ajax="false"
>
> actionListener="#{pf_ordersController.refreshContractsToDownload()}">
>   <p:fileDownload value="#{contractToDownload.file}"/>
> </p:commandLink>
>
> Test and results:
>
> clicked Download button, PDF downloaded to Google Nexus 7 (Google Chrome
> browser, of course), showed up in notifications, instead of PDF Viewer app,
> I selected to open the PDF document in Adobe Acrobat (app that was
> downloaded from Google Play).
>
> ---view---
> <h:commandLink value="View" target="_blank"
>
> actionListener="#{pf_ordersController.refreshContractsToDownload()}">
>   <p:fileDownload value="#{contractToDownload.file}"
>              contentDisposition="inline"/>
> </h:commandLink>
>
> Test and results:
>
> clicked View button, I saw another web page tab open rather quickly in the
> Google Chrome browser on Google Nexus 7, and then the new tab closed
> immediately, and then I saw the 'Starting download' toast (at bottom of
> Google Nexus 7), but I didn't see the file in notifications or downloads,
> and I didn't see any exceptions in my TomEE/tomcat7 logs.
>
> With that said, maybe I just duplicated this issue/exception that you have
> been experiencing. If I'm not mistaking, PrimeFaces is using the servlet
> solution for file downloads.
>
> So, based on this test of mine, it is best to offer a 'download' hyperlink
> 'only' on mobile devices as I am already detecting mobile devices when they
> login to the web app.
>
> Thanks for this topic. now I know what i 'need' to do. :)
>
>
Forgot to mention; i would definitely provide an option for files to be
emailed to endusers. my web app has that option as well as it is more
reliable.

i have found that endusers do a lot of multi-tasking on mobile devices, and
mobile browsers seem to lose connection when they go to some other app. i
may not be describing this correctly, but I have noticed this behavior,
myself.
©2008 junlu.com - Jax Systems, LLC, U.S.A.