mendix / RestServices

REST service module for Mendix. Supports consuming and publishing REST based services and real-time data synchronization. Supports JSON, form-encoded, multipart and binary data transport.
Apache License 2.0
31 stars 46 forks source link

Set file name of file output #29

Closed jveldhuizen closed 9 years ago

jveldhuizen commented 10 years ago

If you download a file, you want to know the file name, via the Content-Disposition header.

mweststrate commented 10 years ago

I think this is a nice feature to add, but in the mean time you could use setResponseHeader to achieve this. If you could share the actual header and header value you are using that would be great :)

jveldhuizen commented 10 years ago

I implemented it this morning in the CloudPortal with

headerName: 'Content-Disposition'

value: 'attachment; filename=' + $mda/Name

However, the implementation of the Mendix file request handler is a little bit more advanced:

Scala:

val fileNamePrefix = if (isIE7or8orChromeFrame) "filename=" else "filename*=UTF-8''" val urlEncodedFileName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20") s"$dispositionType; $fileNamePrefix$urlEncodedFileName"

For the CloudPortal MDA file names, this is not needed (I think), but for the RestServices module, maybe it is better to use filename*=UTF-8'' and URL encoding and the %20 step.

?


Van: Michel Weststrate notifications@github.com Verzonden: maandag 14 juli 2014 11:35 Aan: mendix/RestServices CC: Jonathan Veldhuizen Onderwerp: Re: [RestServices] Set file name of file output (#29)

I think this is a nice feature to add, but in the mean time you could use setResponseHeader to achieve this. If you could share the actual header and header value you are using that would be great :)

Reply to this email directly or view it on GitHubhttps://github.com/mendix/RestServices/issues/29#issuecomment-48881007.