Hi Bogdan,
I assume the last map is for options only. All headers should go into
the second map.
Try with:
return (
web:response-header(
map { 'media-type': web:content-type($path) },
map { 'Cache-Control': 'max-age=3600,public', 'Set-Cookie':
'JSESSIONID=' || session:id() || ';max-age=1800' },
map { 'status' : 200}
),
file:read-binary($path)
}
On 18/09/2018 00:30, Bogdan Bogucki wrote:
Hello,
When I try invoke following code:
return (
web:response-header(
map { 'media-type': web:content-type($path) },
map { 'Cache-Control': 'max-age=3600,public' },
map { 'Set-Cookie': 'JSESSIONID=' || session:id() ||
';max-age=1800' }
),
file:read-binary($path)
}
I receive error:
[XPTY0004] Unknown option 'Set-Cookie'.
I am able to set cookie using <rest:response>.
Following code is working:
return (
<rest:response>
<http:response status="200" message="OK">
<http:header name="media-type" value="{web:content-type($path)}"/>
<http:header name="Content-Type" value="text/html"/>
<http:header name="Cache-Control" value="max-age=3600,public"/>
<http:header name="Set-Cookie" value="{'JSESSIONID=' ||
session:id() || ';max-age=1800'}"/>
</http:response>
</rest:response>,
file:read-binary($path)
)
I think function web:response-header should allow set cookie.
Regards
Bogdan Bogucki