You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Ondrej Svetlik <on...@svetlik.info> on 2006/06/12 01:24:04 UTC
PhaseListener for image rendering - problem
Hello all,
I have a simple phase listener to send image data from database. It
works fine until I want to download two images paralelly. The last
action I do after sending all data to the client is
fc.responseComplete();
where fc is a FacesContext. I tried to download two images and when the
last one finishes, I get an exception:
01:17:05,280 INFO [/ropp]:646 - ImageListener.afterPhase(): /image/688
01:17:06,333 INFO [/ropp]:646 - ImageListener.afterPhase(): /image/691
01:17:14,493 ERROR PhaseListenerManager:91 - Exception in PhaseListener
RESTORE_VIEW(1) afterPhase
java.lang.IllegalStateException: FacesContext already released
at
org.apache.myfaces.context.servlet.ServletFacesContextImpl.responseComplete(ServletFacesContextImpl.java:327)
at ImageListener.handleImageRequest(ImageListener.java:105)
at ImageListener.afterPhase(ImageListener.java:35)
at
org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
Any ideas how to fix this problem?
Best regards
Ondrej Svetlik
Re: PhaseListener for image rendering - problem
Posted by Ondrej Svetlik <on...@svetlik.info>.
Cagatay Civici wrote:
> Interesting error,
>
> I've used a phaselistener to render multiple images in a page when
> developing the new version of chart creator with no problem.
>
> FacesContextFactory creates FacesContext objects bound to each request
> lifecycle. FacesContext's release method is used for pooling not to
> create a FacesContext for each request, this seems to be the reason. The
> solution could be to figure out a way to tell faces not to to do
> pooling. Any ideas?
>
> Cagatay
>
Interesting but annoying. I tried to call fc.responseComplete() before
the data transfer (I looked into the sources and saw it only sets one
boolean value). It doesn't produce any exceptions now, but also it sends
no data, the page stays empty.
You said you had no problems with this, may be I should try some new
snapshot. What version of myfaces did you use?
Best regards
Ondrej Svetlik
Re: PhaseListener for image rendering - problem
Posted by Cagatay Civici <ca...@gmail.com>.
Interesting error,
I've used a phaselistener to render multiple images in a page when
developing the new version of chart creator with no problem.
FacesContextFactory creates FacesContext objects bound to each request
lifecycle. FacesContext's release method is used for pooling not to create a
FacesContext for each request, this seems to be the reason. The solution
could be to figure out a way to tell faces not to to do pooling. Any ideas?
Cagatay
On 6/12/06, Matthias Wessendorf <ma...@apache.org> wrote:
>
> hey,
>
> you may take a look at [1]
>
> -Matthias
>
> [1]
> http://jroller.com/page/cagataycivici?entry=phaselistener_renders_an_image_no
>
> On 6/11/06, Ondrej Svetlik <on...@svetlik.info> wrote:
> > Hello all,
> >
> > I have a simple phase listener to send image data from database. It
> > works fine until I want to download two images paralelly. The last
> > action I do after sending all data to the client is
> >
> > fc.responseComplete();
> >
> > where fc is a FacesContext. I tried to download two images and when the
> > last one finishes, I get an exception:
> >
> > 01:17:05,280 INFO [/ropp]:646 - ImageListener.afterPhase(): /image/688
> > 01:17:06,333 INFO [/ropp]:646 - ImageListener.afterPhase(): /image/691
> > 01:17:14,493 ERROR PhaseListenerManager:91 - Exception in PhaseListener
> > RESTORE_VIEW(1) afterPhase
> > java.lang.IllegalStateException: FacesContext already released
> > at
> >
> org.apache.myfaces.context.servlet.ServletFacesContextImpl.responseComplete
> (ServletFacesContextImpl.java:327)
> > at ImageListener.handleImageRequest(ImageListener.java:105)
> > at ImageListener.afterPhase(ImageListener.java:35)
> > at
> >
> org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter
> (PhaseListenerManager.java:89)
> >
> > Any ideas how to fix this problem?
> >
> > Best regards
> >
> > Ondrej Svetlik
> >
>
>
> --
> Matthias Wessendorf
> Aechterhoek 18
> 48282 Emsdetten
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com
>
Re: PhaseListener for image rendering - problem
Posted by Matthias Wessendorf <ma...@apache.org>.
hey,
you may take a look at [1]
-Matthias
[1] http://jroller.com/page/cagataycivici?entry=phaselistener_renders_an_image_no
On 6/11/06, Ondrej Svetlik <on...@svetlik.info> wrote:
> Hello all,
>
> I have a simple phase listener to send image data from database. It
> works fine until I want to download two images paralelly. The last
> action I do after sending all data to the client is
>
> fc.responseComplete();
>
> where fc is a FacesContext. I tried to download two images and when the
> last one finishes, I get an exception:
>
> 01:17:05,280 INFO [/ropp]:646 - ImageListener.afterPhase(): /image/688
> 01:17:06,333 INFO [/ropp]:646 - ImageListener.afterPhase(): /image/691
> 01:17:14,493 ERROR PhaseListenerManager:91 - Exception in PhaseListener
> RESTORE_VIEW(1) afterPhase
> java.lang.IllegalStateException: FacesContext already released
> at
> org.apache.myfaces.context.servlet.ServletFacesContextImpl.responseComplete(ServletFacesContextImpl.java:327)
> at ImageListener.handleImageRequest(ImageListener.java:105)
> at ImageListener.afterPhase(ImageListener.java:35)
> at
> org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
>
> Any ideas how to fix this problem?
>
> Best regards
>
> Ondrej Svetlik
>
--
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com