Hi,

If your managed bean (export) is using the Servlet Response, it seems to me
difficult to make it work without sending the serialized object itself.
Moreover, I agree, it's not clear at all.

I would recommend to change the export bean a bit and make it work with
common Input/OutputStream.
Then, the caller can strean the output from the export bean in the servlet
response and does not need to send the response itself.

Hope I got the question and it helps.
JLouis


2012/8/26 Marco de Booij <marco.develo...@debooy.eu>

> Hello,
>
> I have a technical question.
>
> I use:
>   - apache-tomee-plus-1.1.0-**SNAPSHOT from August 24
>   - Ubuntu 12.04
>   - java version "1.6.0_24"
>     OpenJDK Runtime Environment (IcedTea6 1.11.3)
> (6b24-1.11.3-1ubuntu0.12.04.1)
>     OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
>
> I have an application with a JSF Managed Bean (export) that generates a
> PDF file and returns it to the browser. I call the Managed Bean as follows:
>     ExportManager exportBean  = (ExportManager) FacesContext.**
> getCurrentInstance().**getApplication().**getELResolver().getValue(**context.getELContext(),
> null, "export");
>     exportBean.export(exportData);
>
> I do not want to put this bean in every application that I make. This way
> I only have the JasperReport and its dependent libraries once.
> So to access this bean from other applications I can not do it this way
> (or am I wrong?). I make it a remote bean so I can define it with an @EJB
> annotation or through a JNDI lookup. This does not work because the
> FacesContext is null:
>       HttpServletResponse response  = (HttpServletResponse) FacesContext.*
> *getCurrentInstance().**getExternalContext().**getResponse();
>
> I tried to find how to get the HttpServletResponse but I could not.
> Passing the HttpServletResponse is a solution that is discouraged.
>
> So my question is: "What is the best way to do this?" A WebService looks
> heavy to me since I only have 1 application server involved.
>
> I got it working a while ago in Glassfish. Forgot how and I lost the war
> file and sources
>
> Regards,
>
> Marco
>
>

Reply via email to