[seam-issues] [JBoss JIRA] (SOLDER-309) @Observes HttpServletResponse causes IllegalProductException

Ove Ranheim (Issue Comment Edited) (JIRA) jira-events at lists.jboss.org
Thu Dec 15 13:30:09 EST 2011


    [ https://issues.jboss.org/browse/SOLDER-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651377#comment-12651377 ] 

Ove Ranheim edited comment on SOLDER-309 at 12/15/11 1:29 PM:
--------------------------------------------------------------

Regrading #1. JsfRedirectObserverTest: changing to (@Observes HttpSevletResponse response) solves the IllegalStateException state issue. This is still a subject to interpretation. Because, would it make sense to inject a response instance that is not in a "unsable" state.

Regarding #2: JsfSecurityRulesTest: I don't see any miss-configuration here. This is how it should work, or convince me wrong. Because a user may request a protected bookmarkable URL and consequently should be redirected to the initial request, after login.
                
      was (Author: oranheim):
    Regrading #1. JsfRedirectObserverTest: changing to (@Observes HttpSevletResponse response) solves the IllegalStateException state issue. This is still a subject to interpretation. Because, would it make sense to inject a response instance that is not in a "usable" state.

Regarding #2: JsfSecurityRulesTest: I don't see any miss-configuration here. This is how it should work, or convince me wrong. Because a user may request a protected bookmarkable URL and consequently should be redirected to the initial request, after login.
                  
> @Observes HttpServletResponse causes IllegalProductException
> ------------------------------------------------------------
>
>                 Key: SOLDER-309
>                 URL: https://issues.jboss.org/browse/SOLDER-309
>             Project: Solder
>          Issue Type: Bug
>          Components: Servlet
>    Affects Versions: 3.1.0.CR1
>            Reporter: Ove Ranheim
>            Assignee: Shane Bryzak
>             Fix For: 3.1.0.Final
>
>         Attachments: SolderHttpServletResponseTest.zip
>
>
> The ImplicitHttpServletObjectsProducer.getHttpServletResponse() produces a null instance when invoked from an @Observer.
> {noformat}
> public void observeHttpRequest(@Observes @Initialized HttpServletRequest request, HttpServletResponse response) {
>     final String path = request.getServletPath();
>     
>     if (identity.isLoggedIn()) {
>         // Redirect user to dashboard if landing page is requested
>         if ("/index".equals(path) || "/index.jsf".equals(path)) {
>             log.infof("Authorized request to: %s. Will be redirected to home!", path);
>             try {
>                 response.sendRedirect(request.getContextPath() + "/home");
>             } catch (IOException e) {
>                 e.printStackTrace();
>             }
>         }
>     }
> }
> {noformat}
> Causes the exception:
> {noformat}
> org.jboss.weld.exceptions.IllegalProductException: WELD-000052 Cannot return null from a non-dependent producer method:  [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletResponse()
> 	org.jboss.weld.bean.AbstractProducerBean.checkReturnValue(AbstractProducerBean.java:256)
> 	org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:362)
> 	org.jboss.weld.context.AbstractContext.get(AbstractContext.java:122)
> 	org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
> 	org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:124)
> 	org.jboss.weld.proxies.HttpServletResponse$1903192262$Proxy$_$$_WeldClientProxy.sendRedirect(HttpServletResponse$1903192262$Proxy$_$$_WeldClientProxy.java)
> 	com.musific.webapp.session.HttpRequestWatcher.observeHttpRequest(HttpRequestWatcher.java:80)
> 	com.musific.webapp.session.HttpRequestWatcher$Proxy$_$$_WeldClientProxy.observeHttpRequest(HttpRequestWatcher$Proxy$_$$_WeldClientProxy.java)
> 	sun.reflect.GeneratedMethodAccessor223.invoke(Unknown Source)
> 	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	java.lang.reflect.Method.invoke(Method.java:597)
> 	org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
> 	org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
> 	org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
> 	org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
> 	org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
> 	org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
> 	org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
> 	org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
> 	org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
> 	org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
> 	org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635)
> 	org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622)
> 	org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616)
> 	org.jboss.solder.servlet.event.AbstractServletEventBridge.fireEvent(AbstractServletEventBridge.java:45)
> 	org.jboss.solder.servlet.event.ServletEventBridgeListener.requestInitialized(ServletEventBridgeListener.java:76)
> 	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
> 	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
> 	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
> 	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
> 	java.lang.Thread.run(Thread.java:680)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list