myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: The content-type does not change
Date Tue, 04 Apr 2006 15:02:13 GMT
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 <the.marin@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  <-|
> |------------------------------|
>

Mime
View raw message