Re: how to download file (example)

2005-05-11 Thread Fco Javier Jiemnez
This is a little example :

response.setHeader("Content-Disposition",
   "attachment; filename=\"" + part.getFileName()
 + "\"");
 response.setContentType(part.getContentType());
 InputStream instream = part.getInputStream();
 ServletOutputStream outstream = response.getOutputStream();

 int b = 0;
 while (b != -1) {

  b = instream.read();
  outstream.write(b);

 }
 instream.close();
 outstream.close();


WHERE part.getFileName() sustitute by the Filename of the File,
  part.getContentType() sustitute the ContentType of the File
  part.getInputStream(); sustitute the Stream Data of the File.


That's all!






- Original Message -
From: "Grzegorz Stasica" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, May 11, 2005 9:30 PM
Subject: Re: how to download file (example)


> Frank W. Zammetti wrote:
> > Hello,
> >
> > Do you want to use the Struts DownloadAction?  If so, have a look here:
> >
> > http://wiki.apache.org/struts/StrutsFileDownload
> >
> > Even if you don't want to use it, you may find the example helpful,
along
> > with the source for DownloadAction, to help you along.
> >
> Unfortunatelly I am running struts 1.2.4. DownloadActioni will be
> available in 1.2.6 version which at this moment is in beta phase
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts 1.2 +Tomcat +SSL Problem

2005-05-10 Thread Fco Javier Jiemnez
Hello,

I have a problem with Tomcat 5.0.28 with SSL mode enabled + Struts 1.2 + 
Windows XP + j2sdk 1.4.2

When I use Tomcat in ssl mode i read this error in console every time that 
click a link aplication web.

10-may-2005 0:55:21 org.apache.tomcat.util.net.TcpWorkerThread runIt
GRAVE: Remote Host /192.168.0.1 SocketException: Software caused connection 
abort: recv failed


If  I use http in 8080, there isn't error but if I use https 8443 appears the 
error.

I uncomment server.xml to enable ssl mode in Tomcat(default port 8443) and y 
generate self-signed certificate with keytool (default password changeit)

Anybody helps me? What's the problem?


Thanks.

PD: Sorry but my english is bad ;P