hi,

in addition you can add the desired fileName (as the last parameter) to 
the 
context of the ActionLink. this way the user will always see the link to a 
file if
he hovers over:

eg:

@Component(parameter="context=literal:report.csv")
private ActionLink link

the generated link then will look something like this:

/context/page/component1.component2.... . link/report.csv

but don't forget to set the headers as mentioned by carl.

g,
kris




Carl Crowder <[EMAIL PROTECTED]> 
09.09.2008 09:42
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
Tapestry users <users@tapestry.apache.org>
Kopie

Thema
Re: [T5] Filename of TextStreamResponse ?







If you set the "Content-Disposition" header in the response you can.

Add this to your page:

@Inject
private RequestGlobals requestGlobals;

Then somewhere before you return the stream response, do

requestGlobals.getResponse().setHeader("Content-Disposition",
"attachment; filename=" + <filename>);

Also, you could create your own StreamResponse implementation, or extend
the existing TextStreamResponse, and do that in the "prepareResponse"
method, if that way is more convenient.

Cheers,
Carl

Otho wrote:
> Hello all,
> 
> by defaullt a TextStreamResponse when meant to be saved on disk gets a
> filname composed of <classname.methodname> for example
> 
> export.customers
> 
> Is there any way to override that to something like export_customers.csv
> without having to rename classes and methods accordingly?
> 
> Regards,
> Otho
> 


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


Reply via email to