Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1037

IllegalStateException when redirecting from system event in JSF managed bean

    XMLWordPrintable

    Details

      Description

      I have a view with a system event like so

      <f:metadata>
      <f:event type="preRenderView" listener="#

      {fileUploadBean.checkAccessToken}

      " />
      </f:metadata>

      the listener is just a faces managed bean and performs a redirect using FacesContext.getCurrentInstance().getExternalContext().redirect(...);
      This leads to an exception. When I disable Weld by removing the empty beans.xml file the redirect works fine.

      java.lang.IllegalStateException
      org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:436)
      javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:170)
      org.jboss.weld.servlet.ConversationPropagationFilter$1.sendRedirect(ConversationPropagationFilter.java:90)
      com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:576)
      org.dirtybxl.upload.FileUploadBean.redirectToAuthenticationEntrypoint(FileUploadBean.java:105)
      org.dirtybxl.upload.FileUploadBean.checkAccessToken(FileUploadBean.java:87)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      org.apache.el.parser.AstValue.invoke(AstValue.java:196)
      org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
      org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:56)
      com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      com.sun.faces.facelets.tag.jsf.core.DeclarativeSystemEventListener.processEvent(EventHandler.java:131)
      javax.faces.component.UIComponent$ComponentSystemEventListenerAdapter.processEvent(UIComponent.java:2508)
      javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
      com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2129)
      com.sun.faces.application.ApplicationImpl.invokeComponentListenersFor(ApplicationImpl.java:2077)
      com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:286)
      com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:244)
      org.jboss.as.weld.webtier.jsf.ForwardingApplication.publishEvent(ForwardingApplication.java:293)
      com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
      org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
      org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              luksa Marko Luksa (Inactive)
              Reporter:
              kva Kristof Vanbecelaere (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: