Hello Fabrice,

for the content type you can use

  %output:encoding("UTF-8")
  %output:media-type("text/comma-separated-values")

I don't think there is an annotation for content disposition as it is too specific. However, if you open the link in a new tab most browser should automatically try to download them. We also deliver csv files in a project via the same mechanism and I didn't encounter any problems in major browsers.

Cheers
Dirk

On 11/30/2015 03:07 PM, Etanchaud Fabrice wrote:

Dear all,

 

When I want to set response headers (for example to force a “save as…”),

I currently have to write a specific response before the response body :

 

  <rest:response>

    <http:response>

      <http:header name="Content-Type" value="text/comma-separated-values; charset=utf-8"/>

      <http:header name="Content-Disposition" value="attachment; filename={concat($base, '_Parthenay.csv')}"/>

    </http:response>

  </rest:response>

 

Is there an annotation to set header values directly in the function declaration ?

 

Best regards,

Fabrice


-- 
Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22