File download. How to get filename from header
aerfus opened this issue · comments
Hello,
the code snippet given below
@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response download() {
File file = ...;
String value = "attachment; filename=\"filename\"";
return Response.ok(file)
.header(HttpHeaders.CONTENT_DISPOSITION, value)
.build();
}
produces the following TypeScript code
download(): RestResponse<BlobPart> {
return this.httpClient.request({ method: 'GET', url: uriEncoding`api/` });
}
Could you please suggest on getting fileName from header as
the generated code returns bytes only?
P.S. BlobPart is a part of customTypeMapping
Thank you in advance!
Hi!
@vojtechhabarta & team.
To accomplish the task it is necessary to pass observe and responseType.
E.g.
this.http.get(URL, {headers : headers, observe: 'response', responseType: 'blob'}
My proposal is:
- add optional fields observe and responseType to JaxrsApplicationClient
- add optional parameters observe and responseType to method signature when Content-Disposition is produced by API method
Let me know if there are concerns.
Also, I don't mind implementing this feature.
Dear @sullis @clamothe @emmanueltouzery @nivertius.
Sorry for disturbing.
Just wanted to understand whether the project is active or not
as I see no sign of activity in PRs and Issues.
Dear @vojtechhabarta ,
could you please check the thread above?
Sorry for disturbing...