Hi, I have been searching for an answer on this forum but didn't find any
concrete suggestion.
I have a restful service that would return a binary stream and the type can
be PDF, XLS, etc so in this service I would like to be able to set the
content-type dynamically. From what I read, I can use StreamingOutputImpl to
write out the binary data but for some reason, I can't set the content-type:
public StreamingOutput returnFile(HttpServletResponse hsr, String fileTag)
{
...
hsr.setContentType(content.getContentType());
hsr.setContentLength((int) content.getContentLength());
hsr.setHeader("Content-Disposition", "inline;filename=" +
content.getFileName());
...
return new StreamingOutputImp(content);
}
Apparently, hsr.setContentType doesn't work. content.getContentType()
returns "application/pdf" but the client sees "application/octet-stream" so
I guess it was overwritten by something.
Did anyone run into this kind of questions? any suggestions on workaround
would be appreciated. Thanks
--
View this message in context:
http://old.nabble.com/Using-StreamingOutput---how-to-change-content-type-dynamically--tp27824908p27824908.html
Sent from the cxf-user mailing list archive at Nabble.com.