You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "El Harouchi, Jaafar [IT]" <ja...@citigroup.com> on 2003/06/19 07:00:47 UTC

Path Info for downloaded files

Hi,
I've been trying to get generated PDF and CSV files to be downloaed by my actions but can't get it to work in IE using HTTP 1.0 when my app is behind the corporate portal.  It works when accessed directly through the app (but not when I try to reach the action by putting the full url).

I'm using all the tricks I could find:
      Setting ContentType:  response.setContentType("application/pdf");
      Setting the ContentDisposition: response.setHeader("Content-Disposition", "attachment; filename=file.pdf";
      Adding  8192 bytes to be sure that IE shows the document: ostream.write(new byte[8192]);
      /Setting contentlength: response.setContentLength(data.length+8192);
      // Flush the buffer:  response.flushBuffer();

It works in Netscape 4.7, Netscape 6.
Since IE is the problem and our corporate standard i have to try setting the Path Info, instead on relying on the content disposition.

So how would you set the path info if you have your actions mapped as follows:
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/action/*</url-pattern>
  </servlet-mapping>
and configured as follows:
       <action path="/dailyReports"
                type="com.ssmb.fipb.primedirect.web.reports.DailyReportAction"
                name="reportForm"
                parameter="dispatchMethod"
                scope="request">
                <forward name="next"
                         path="/jsp/dailyReports_cv.jsp"
                         redirect="false"/>
        </action>
These are dispatch actions anf the url is something like:
http://.../action/dailyReports
If I change it to GET from POST it would be:
http://.../action/dailyReports?dispatchMethod=retrieve&reportRequest.reportIds=RDQQPB77&reportRequest.format=pdf&reportRequest.mgmtGroupNumber=51555&reportRequest.actMnemonic=XPBALC

Where would the path info go?
If I add it in between action/file.pdf/dailyReports the mapping fails and my action is not invoked.
If I add it at the very end &test/file.pdf I get the same stupid IE error after it prompts you to open/save.

Any ideas would be greatly appreciate it.

Sorry if it is a little incoherent but we really understimated our effort and have had to work looong hours.

thanks a lot
-jaafar

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


Re: How to downloaded files from server using Struts

Posted by James Mitchell <jm...@apache.org>.
On Thursday 19 June 2003 01:58, Kamalakar Thota wrote:
> Hi All,
>
> How can we download files from server using struts? As of now, I am using
> applet to do this using third party certificate. Please let me know,

That depends on what you are doing.  Are these files dynamically generated?  
Do you require a secure connection?  Need more details....

>
> Thank You,
>
> Kamal.
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!

-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx



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


How to downloaded files from server using Struts

Posted by Kamalakar Thota <ko...@yahoo.com>.


Hi All,

How can we download files from server using struts? As of now, I am using applet to do this using third party certificate. Please let me know,

Thank You,

Kamal.

 



---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!