RE: OT: file download without opening a window

2006-12-07 Thread mano dasanayake
Hi,
As per my knowledge, what you have to do is opening an out stream from your
action.
 Something like...

response.setContentType(application/x-file-download);



response.setHeader(
Content-disposition,
attachment; filename= + Appfile.xml);
response.setHeader(Cache-Control, max-age= +
2);

ServletOutputStream outStream = null;
try {
outStream = response.getOutputStream();
} catch (IOException e1) {

e1.printStackTrace();
}


//call to your backend to get the real out stream for this file..
try {
getFileData(outStream);  //write the
outstraem here..
} catch (FileNotFoundException e2) {
e2.printStackTrace();
}


//and finally 


try {

outStream.flush();
} catch (IOException e3) { 

e3.printStackTrace();
}


return null;  //return Null...so that user will see
a Download popup...

Thanks  regards,
Mano


-Original Message-
From: Søren Blidorf [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 07, 2006 1:06 PM
To: Martin Gainty; Struts Users Mailing List
Subject: Re: OT: file download without opening a window

What I need is for system users to be able to download a specifik xml file
on my server.

The download should start when the user clicks on a button. The click on the
button should copy the action of right-clicking on a link to the xml file
and choosing Save target as. I dont want a new window to open or a
redirect off the page.

Please let me know if I need to explain againg

Br.

Soren


- Original Message -
From: Martin Gainty [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 07, 2006 2:30 AM
Subject: Re: OT: file download without opening a window


 Goddag Søren

 forsøge-

 http://upload.thinfile.com/put/

 med venlig hilsen

 Martin --

 This e-mail communication and any attachments may contain confidential and
privileged information for the use of the
 designated recipients named above. If you are not the intended recipient,
you are hereby notified that you have received
 this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its
 contents
 - Original Message -
 From: Mitchell James [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Wednesday, December 06, 2006 7:23 PM
 Subject: Re: OT: file download without opening a window


 Can you restate what you want?  It's not exactly clear what you are
 asking.


 --
 James Mitchell
 678.910.8017




 On Dec 6, 2006, at 4:56 PM, Søren Blidorf wrote:

  Does anybody know how to make a form button, that starts
  downloading myFile.xml
 
  What I want is to make an onclick = Save target as
 
 
  Med venlig hilsen
 
  Søren Blidorf
  Nolas Consulting
  Web:  http://www.nolas.dk
  Mobil: +45 61676513


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





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



RE: file download without opening a window

2006-12-07 Thread George.Dinwiddie
You need to serve the XML file, itself--not forward to a JSP.  In your action 
class, one of the parameters is an HttpServletResponse instance.  Call 
addHeader() on that object.  Then copy the file contents to the OutputStream 
returned by getOutputStream() on that object.  Finally, the action class should 
return null, indicating that it has taken care of responding to the request.

 Hope that helps,
   George
   http://idiacomputing.com/

 -Original Message-
 From: Søren Blidorf [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, December 06, 2006 5:06 PM
 To: Struts Users Mailing List
 Subject: Re: file download without opening a window
 
 
 Thanks.
 
 How can I add a header without opening a new window or redirect?
 
 - Original Message -
 From: [EMAIL PROTECTED]
 To: user@struts.apache.org
 Sent: Wednesday, December 06, 2006 11:02 PM
 Subject: RE: file download without opening a window
 
 
 add a header Content-Disposition attachment; 
 filename=myFile.xml using
 response.addHeader()
 
  -Original Message-
  From: Søren Blidorf [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, December 06, 2006 4:56 PM
  To: Struts Users Mailing List
  Subject: OT: file download without opening a window
 
 
  Does anybody know how to make a form button, that starts 
 downloading 
  myFile.xml
 
  What I want is to make an onclick = Save target as
 
 
  Med venlig hilsen
 
  Søren Blidorf
  Nolas Consulting
  Web:  http://www.nolas.dk
  Mobil: +45 61676513
 
 
 -
 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]
 
 

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



OT: file download without opening a window

2006-12-06 Thread Søren Blidorf
Does anybody know how to make a form button, that starts downloading myFile.xml

What I want is to make an onclick = Save target as


Med venlig hilsen

Søren Blidorf
Nolas Consulting
Web:  http://www.nolas.dk
Mobil: +45 61676513


RE: file download without opening a window

2006-12-06 Thread George.Dinwiddie
add a header Content-Disposition attachment; filename=myFile.xml using 
response.addHeader()

 -Original Message-
 From: Søren Blidorf [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, December 06, 2006 4:56 PM
 To: Struts Users Mailing List
 Subject: OT: file download without opening a window
 
 
 Does anybody know how to make a form button, that starts 
 downloading myFile.xml
 
 What I want is to make an onclick = Save target as
 
 
 Med venlig hilsen
 
 Søren Blidorf
 Nolas Consulting
 Web:  http://www.nolas.dk
 Mobil: +45 61676513
 

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



Re: file download without opening a window

2006-12-06 Thread Søren Blidorf
Thanks.

How can I add a header without opening a new window or redirect?

- Original Message -
From: [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Wednesday, December 06, 2006 11:02 PM
Subject: RE: file download without opening a window


add a header Content-Disposition attachment; filename=myFile.xml using
response.addHeader()

 -Original Message-
 From: Søren Blidorf [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, December 06, 2006 4:56 PM
 To: Struts Users Mailing List
 Subject: OT: file download without opening a window


 Does anybody know how to make a form button, that starts
 downloading myFile.xml

 What I want is to make an onclick = Save target as


 Med venlig hilsen

 Søren Blidorf
 Nolas Consulting
 Web:  http://www.nolas.dk
 Mobil: +45 61676513


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



Re: OT: file download without opening a window

2006-12-06 Thread Mitchell James
Can you restate what you want?  It's not exactly clear what you are  
asking.



--
James Mitchell
678.910.8017




On Dec 6, 2006, at 4:56 PM, Søren Blidorf wrote:

Does anybody know how to make a form button, that starts  
downloading myFile.xml


What I want is to make an onclick = Save target as


Med venlig hilsen

Søren Blidorf
Nolas Consulting
Web:  http://www.nolas.dk
Mobil: +45 61676513



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



Re: OT: file download without opening a window

2006-12-06 Thread Søren Blidorf
What I need is for system users to be able to download a specifik xml file
on my server.

The download should start when the user clicks on a button. The click on the
button should copy the action of right-clicking on a link to the xml file
and choosing Save target as. I dont want a new window to open or a
redirect off the page.

Please let me know if I need to explain againg

Br.

Soren


- Original Message -
From: Martin Gainty [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 07, 2006 2:30 AM
Subject: Re: OT: file download without opening a window


 Goddag Søren

 forsøge-

 http://upload.thinfile.com/put/

 med venlig hilsen

 Martin --

 This e-mail communication and any attachments may contain confidential and
privileged information for the use of the
 designated recipients named above. If you are not the intended recipient,
you are hereby notified that you have received
 this communication in error and that any review, disclosure,
dissemination, distribution or copying of it or its
 contents
 - Original Message -
 From: Mitchell James [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Wednesday, December 06, 2006 7:23 PM
 Subject: Re: OT: file download without opening a window


 Can you restate what you want?  It's not exactly clear what you are
 asking.


 --
 James Mitchell
 678.910.8017




 On Dec 6, 2006, at 4:56 PM, Søren Blidorf wrote:

  Does anybody know how to make a form button, that starts
  downloading myFile.xml
 
  What I want is to make an onclick = Save target as
 
 
  Med venlig hilsen
 
  Søren Blidorf
  Nolas Consulting
  Web:  http://www.nolas.dk
  Mobil: +45 61676513


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