Re: zip stream and content-type in portlet

2004-08-06 Thread Raphaël Luta
Frédéric FACHINETTI wrote:
Hello,
I have a portlet that query a database and then display
the resultset using some JSP's.
Now, I want to retrieve the query results not in html 
format but in a zip file format ie when I submit the
query in my portlet I then have the save as ... window
and I'm able to retrieve the query results thru a zipped 
text file.

I managed to do it in an old perl application by changing 
the content-type and by printing the result in a zip stream.

But with java and Jetspeed, I have no idea if it's possible 
and how to proceed.

Is there a content-type specific to each portlet ?
Nope, HTTP only defines a content-type for a whole response.
To do this within Jetspeed, you ned to define a new screen
template for example:
WEB-InF/conf/templates/vm|jsp/SendFile.vm:
$data.Response.setContentType(application/octet-stream)$file
create an action to set the file object in the context
to the ZIP file you want to send
in your portlet create a link to this screen like this:
jetspeed-root/template/SendFile/action/MySendAction.
This is standard Turbine stuff so you should probably
check out the Turbine documentation and mailing-list for
further examples of how to use the Turbine screen to
send non-HTML output.
--
Raphaël Luta - [EMAIL PROTECTED]
Apache Jetspeed - Enterpise Portal in Java
http://portals.apache.org/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: zip stream and content-type in portlet

2004-08-06 Thread Frédéric FACHINETTI
Thank you Raphael.

I will try that right away.

Fred

On Thu, 2004-08-05 at 23:09, Raphaël Luta wrote:
 Frédéric FACHINETTI wrote:
  Hello,
  
  I have a portlet that query a database and then display
  the resultset using some JSP's.
  
  Now, I want to retrieve the query results not in html 
  format but in a zip file format ie when I submit the
  query in my portlet I then have the save as ... window
  and I'm able to retrieve the query results thru a zipped 
  text file.
  
  I managed to do it in an old perl application by changing 
  the content-type and by printing the result in a zip stream.
  
  But with java and Jetspeed, I have no idea if it's possible 
  and how to proceed.
  
  Is there a content-type specific to each portlet ?
  
 
 Nope, HTTP only defines a content-type for a whole response.
 
 To do this within Jetspeed, you ned to define a new screen
 template for example:
 WEB-InF/conf/templates/vm|jsp/SendFile.vm:
 $data.Response.setContentType(application/octet-stream)$file
 
 create an action to set the file object in the context
 to the ZIP file you want to send
 
 in your portlet create a link to this screen like this:
 jetspeed-root/template/SendFile/action/MySendAction.
 
 This is standard Turbine stuff so you should probably
 check out the Turbine documentation and mailing-list for
 further examples of how to use the Turbine screen to
 send non-HTML output.
 
 --
 Raphaël Luta - [EMAIL PROTECTED]
 Apache Jetspeed - Enterpise Portal in Java
 http://portals.apache.org/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



O.S.B
Oceanienne de Services Bancaires

BP 9178 Motu Uta
98715 Papeete
Tahiti - Polynesie Francaise

Site : http://www.osb.pf
Tel : (689) 54 08 00
Fax : (689) 41 34 08
**
Ce message et toutes les pieces jointes (ci-apres le message) sont
etablis a l'intention exclusive de ses destinataires et sont confidentiels.
Si vous recevez ce message par erreur, merci de le detruire et d'en 
avertir immediatement l'expediteur.
Toute utilisation de ce message non conforme a sa destination,
toute diffusion ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. 
L'Internet ne permettant pas d'assurer l'integrite de ce message, 
l'OSB decline toute responsabilite au titre de ce message, dans 
l'hypothese ou il aurait ete modifie ou infeste par un virus.


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