You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Sébastien Marin <th...@free.fr> on 2006/04/04 09:36:48 UTC
The content-type does not change
Hello, i'am working on BIRT printing with HTML and PDF format.
So My report are OK and i can display it in HTML on a new Window.
First pb : how can i open a popup in jsf? So i use Jenia popup...
Second pb : to display the PDF report generates, i have to change the
content-typt of the response. But when i am in debug, the content-type doesn't
change and stay at "html/text". So my report isn't displayed properly.
<-------------------------------------------------------->
FacesContext context = FacesContext.getCurrentInstance();
HttpServletResponse httpServletResponse =
context.getExternalContext().getResponse();
httpServletResponse .setContentType("application/pdf");
<-------------------------------------------------------->
I work on a jetspeed portal.
Please help me to solve or understand the problem.
|Cordialement, Sébastien MARIN.|
|------------------------------|
|-> http://www.marin-s.com <-|
|------------------------------|
Re: The content-type does not change
Posted by Mike Kienenberger <mk...@gmail.com>.
For what it's worth, I successfully use this. But I don't know if
it's portlet-friendly.
OutputStream responseStream =
((HttpServletResponse)facesContext.getExternalContext().getResponse()).getOutputStream();
HttpServletResponse response =
(HttpServletResponse)facesContext.getExternalContext().getResponse();
response.setContentType(selectedContent.getContentType());
response.setHeader("Content-Disposition","attachment;filename=\""
+ selectedContent.getContentId() + "\"");
response.setContentLength(selectedContent.getContentData().getData().length);
responseStream.write(selectedContent.getContentData().getData());
response.flushBuffer();
facesContext.responseComplete();
On 4/4/06, Sébastien Marin <th...@free.fr> wrote:
> Hello, i'am working on BIRT printing with HTML and PDF format.
>
> So My report are OK and i can display it in HTML on a new Window.
>
> First pb : how can i open a popup in jsf? So i use Jenia popup...
>
> Second pb : to display the PDF report generates, i have to change the
> content-typt of the response. But when i am in debug, the content-type doesn't
> change and stay at "html/text". So my report isn't displayed properly.
> <-------------------------------------------------------->
> FacesContext context = FacesContext.getCurrentInstance();
> HttpServletResponse httpServletResponse =
> context.getExternalContext().getResponse();
> httpServletResponse .setContentType("application/pdf");
> <-------------------------------------------------------->
>
> I work on a jetspeed portal.
>
> Please help me to solve or understand the problem.
>
> |Cordialement, Sébastien MARIN.|
> |------------------------------|
> |-> http://www.marin-s.com <-|
> |------------------------------|
>