You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Shannon, Andrew" <an...@pqa.com> on 2009/03/25 14:25:32 UTC

file download problem in application server

I posted this question on the OTN - OC4J list a second ago, but am
hoping someone here might have some insight.

 

"I have a web app running in an OC4J stand alone 10.1.3.3 and am having
a problem with downloading files over http. Its a struts2 app whose file
downloading impl is easy to use and standard code for writing to an http
servlet response output stream.

Using the firefox plugin for Live Headers I can see that the headers are
correctly added to the servlet response and I do get the file I want.
However the file has been mangled with binary output around the text.
This is the case for txt, word, or any other file.

This problem does not occur in Jetty or Tomcat. I've also ruled out file
corruption while going in/out of the database since I can upload a file
when running oc4j, turn off oc4j, start up my app in Jetty and retrieve
the same file just fine.

The mime types are all accounted for and the problem exists regardless
if I use a specific content type or just application/download. My
browsers (firefox and ie) also recognize all files from the content
disposition value "attachment; filename=myfilename.ext". Its just the
file content that some how has been wrecked on the way out of the
container.

Has anyone experienced this? I only found one or two unanswered posts
elsewhere.

How can this be mitigated?"

 

What I didn't include in the above post is that we're on s2 2.0.14, also
that I put on my pirate hat and created a custom result type based on
the StreamResult so that I could specifically set some additional
response headers.  It all works great in a servlet container, but I'd
like to know if you all have seen this problem in application servers
like oc4j or jboss and if so what did you do to fix it?  I'm open to any
suggestions.

 

Thanks a bunch,

Andrew

 


RE: file download problem in application server

Posted by "Shannon, Andrew" <an...@pqa.com>.
Actually no.  We intentionally did not make my class with the blob
property a serializable class, mainly because blobs are not serializable
(if I'm not mistaken) and if they are, there's no reason for us to store
this particular object in serialized form (we're not clustering or
putting this object in the session).  There's actually a lot of good
discussion to be had regarding what should be serializable, and for what
reasons, versus what should not be.  So in this case we chose not.

Which brings me to ask a struts2 question I've been meaning to ask, and
that is why does ActionSupport implement serializable?  It seems to me
like this is potentially unnecessary overhead.

Is it because of how actions are loaded and managed in Spring for
example?  Or in anticipation of clustering?  I would have thought that
actions as pojo's don't need to be serializable and would have left it
up to programmers to implement the interface only when needed.  So I'm
interested to learn more about this part of the struts 2 implementation.

Thanks,
Andrew

-----Original Message-----
From: Martin Gainty [mailto:mgainty@hotmail.com] 
Sent: Thursday, March 26, 2009 10:38 AM
To: Struts Users Mailing List
Subject: RE: file download problem in application server


I assume your blob Class is Serializable?
http://www.hibernate.org/hib_docs/v3/reference/en/html_single/
?
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
This message is confidential and may be privileged. If you are not the
intended recipient, we kindly ask you to  please inform the sender. Any
unauthorised dissemination or copying hereof is prohibited. This message
serves for information purposes only and shall not have any legally
binding effect. Given that e-mails can easily be subject to
manipulation, we can not accept any liability for the content provided.






> Subject: RE: file download problem in application server
> Date: Thu, 26 Mar 2009 08:20:19 -0400
> From: andrewshannon@pqa.com
> To: user@struts.apache.org
> 
> I was half wrong.  It was a quirk for runnnig in OC4J but the Blob was
> being mangled coming out of the data base (which I had previously
ruled
> out, doh).
> 
> Adding a property to the hibernate.properties file for:
> hibernate.jdbc.use_streams_for_binary=true
> 
> fixed my problem.  Otherwise file handling in struts 2 is a snap.  So
> thanks for that.
> 
> -----Original Message----- 
> Sent: Wednesday, March 25, 2009 9:26 AM
> To: user@struts.apache.org
> Subject: file download problem in application server
> 
> I posted this question on the OTN - OC4J list a second ago, but am
> hoping someone here might have some insight.
> 
>  
> 
> "I have a web app running in an OC4J stand alone 10.1.3.3 and am
having
> a problem with downloading files over http. Its a struts2 app whose
file
> downloading impl is easy to use and standard code for writing to an
http
> servlet response output stream.
> 
> Using the firefox plugin for Live Headers I can see that the headers
are
> correctly added to the servlet response and I do get the file I want.
> However the file has been mangled with binary output around the text.
> This is the case for txt, word, or any other file.
> 
> This problem does not occur in Jetty or Tomcat. I've also ruled out
file
> corruption while going in/out of the database since I can upload a
file
> when running oc4j, turn off oc4j, start up my app in Jetty and
retrieve
> the same file just fine.
> 
> The mime types are all accounted for and the problem exists regardless
> if I use a specific content type or just application/download. My
> browsers (firefox and ie) also recognize all files from the content
> disposition value "attachment; filename=myfilename.ext". Its just the
> file content that some how has been wrecked on the way out of the
> container.
> 
> Has anyone experienced this? I only found one or two unanswered posts
> elsewhere.
> 
> How can this be mitigated?"
> 
>  
> 
> What I didn't include in the above post is that we're on s2 2.0.14,
also
> that I put on my pirate hat and created a custom result type based on
> the StreamResult so that I could specifically set some additional
> response headers.  It all works great in a servlet container, but I'd
> like to know if you all have seen this problem in application servers
> like oc4j or jboss and if so what did you do to fix it?  I'm open to
any
> suggestions.
> 
>  
> 
> Thanks a bunch,
> 
> Andrew
> 
>  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Internet Explorer 8 - Get your Hotmail Accelerated.  Download free!
http://clk.atdmt.com/MRT/go/141323790/direct/01/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: file download problem in application server

Posted by Martin Gainty <mg...@hotmail.com>.
I assume your blob Class is Serializable?
http://www.hibernate.org/hib_docs/v3/reference/en/html_single/
?
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to  please inform the sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided.






> Subject: RE: file download problem in application server
> Date: Thu, 26 Mar 2009 08:20:19 -0400
> From: andrewshannon@pqa.com
> To: user@struts.apache.org
> 
> I was half wrong.  It was a quirk for runnnig in OC4J but the Blob was
> being mangled coming out of the data base (which I had previously ruled
> out, doh).
> 
> Adding a property to the hibernate.properties file for:
> hibernate.jdbc.use_streams_for_binary=true
> 
> fixed my problem.  Otherwise file handling in struts 2 is a snap.  So
> thanks for that.
> 
> -----Original Message----- 
> Sent: Wednesday, March 25, 2009 9:26 AM
> To: user@struts.apache.org
> Subject: file download problem in application server
> 
> I posted this question on the OTN - OC4J list a second ago, but am
> hoping someone here might have some insight.
> 
>  
> 
> "I have a web app running in an OC4J stand alone 10.1.3.3 and am having
> a problem with downloading files over http. Its a struts2 app whose file
> downloading impl is easy to use and standard code for writing to an http
> servlet response output stream.
> 
> Using the firefox plugin for Live Headers I can see that the headers are
> correctly added to the servlet response and I do get the file I want.
> However the file has been mangled with binary output around the text.
> This is the case for txt, word, or any other file.
> 
> This problem does not occur in Jetty or Tomcat. I've also ruled out file
> corruption while going in/out of the database since I can upload a file
> when running oc4j, turn off oc4j, start up my app in Jetty and retrieve
> the same file just fine.
> 
> The mime types are all accounted for and the problem exists regardless
> if I use a specific content type or just application/download. My
> browsers (firefox and ie) also recognize all files from the content
> disposition value "attachment; filename=myfilename.ext". Its just the
> file content that some how has been wrecked on the way out of the
> container.
> 
> Has anyone experienced this? I only found one or two unanswered posts
> elsewhere.
> 
> How can this be mitigated?"
> 
>  
> 
> What I didn't include in the above post is that we're on s2 2.0.14, also
> that I put on my pirate hat and created a custom result type based on
> the StreamResult so that I could specifically set some additional
> response headers.  It all works great in a servlet container, but I'd
> like to know if you all have seen this problem in application servers
> like oc4j or jboss and if so what did you do to fix it?  I'm open to any
> suggestions.
> 
>  
> 
> Thanks a bunch,
> 
> Andrew
> 
>  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Internet Explorer 8 – Get your Hotmail Accelerated.  Download free!
http://clk.atdmt.com/MRT/go/141323790/direct/01/

RE: file download problem in application server

Posted by "Shannon, Andrew" <an...@pqa.com>.
I was half wrong.  It was a quirk for runnnig in OC4J but the Blob was
being mangled coming out of the data base (which I had previously ruled
out, doh).

Adding a property to the hibernate.properties file for:
hibernate.jdbc.use_streams_for_binary=true

fixed my problem.  Otherwise file handling in struts 2 is a snap.  So
thanks for that.

-----Original Message----- 
Sent: Wednesday, March 25, 2009 9:26 AM
To: user@struts.apache.org
Subject: file download problem in application server

I posted this question on the OTN - OC4J list a second ago, but am
hoping someone here might have some insight.

 

"I have a web app running in an OC4J stand alone 10.1.3.3 and am having
a problem with downloading files over http. Its a struts2 app whose file
downloading impl is easy to use and standard code for writing to an http
servlet response output stream.

Using the firefox plugin for Live Headers I can see that the headers are
correctly added to the servlet response and I do get the file I want.
However the file has been mangled with binary output around the text.
This is the case for txt, word, or any other file.

This problem does not occur in Jetty or Tomcat. I've also ruled out file
corruption while going in/out of the database since I can upload a file
when running oc4j, turn off oc4j, start up my app in Jetty and retrieve
the same file just fine.

The mime types are all accounted for and the problem exists regardless
if I use a specific content type or just application/download. My
browsers (firefox and ie) also recognize all files from the content
disposition value "attachment; filename=myfilename.ext". Its just the
file content that some how has been wrecked on the way out of the
container.

Has anyone experienced this? I only found one or two unanswered posts
elsewhere.

How can this be mitigated?"

 

What I didn't include in the above post is that we're on s2 2.0.14, also
that I put on my pirate hat and created a custom result type based on
the StreamResult so that I could specifically set some additional
response headers.  It all works great in a servlet container, but I'd
like to know if you all have seen this problem in application servers
like oc4j or jboss and if so what did you do to fix it?  I'm open to any
suggestions.

 

Thanks a bunch,

Andrew

 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org