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

Ove Ranheim (Issue Comment Edited) (JIRA) jira-events at lists.jboss.org
Fri Dec 16 14:17:09 EST 2011


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

Ove Ranheim edited comment on SOLDER-309 at 12/16/11 2:15 PM:
--------------------------------------------------------------

There's a bit of doubt (from my side at least) to what should be the expected behavior. Below is an seam-dev chat snippet to shed light on topic.

[09:59am] oranheim: maschmid: i do see you point with #1, so it's not a bug. It's correct behaviorr
[09:59am] oranheim: maschmid: but, what is the correct faces-config.xml configuration then. Because, you need to have a identity.login rule in order to redirect the user during normal login.. I'm a bit confused here
[11:14am] maschmid: oranheim, I agree with you that there should be a way to tell it to redirect somewhere else if you go to the login page explicitly... I don't think it is possible right now to do it in any clean way... currently it seems that the only way is to make the "login" button go to "home" or whatever view you want to end up after the successful login..
[11:16am] maschmid: we should probably ask bleathem what he thinks about this...
[11:17am] oranheim: maschmid: Marek, that is not a satisfactory solution, because it violates with the principles of @ViewConfig where you declare restricted views. So, it will make that great feature unusable. It's in fact such a blocker, that my company can't upgrade and move on to the next level.. Let's discuss this with Brian
[11:18am] oranheim: maschmid: Re issue #1. Using @Initialed HttpServletResponse works just fine in my app now
[11:29am] maschmid: oranheim, I still don't quite understand why you need to go to the login page explicitly... isn't the point of the @LoginView to automatically redirect you to the login view whenever you need? (now of course the button in the UI will probably be labeled "login" as that is what the user expects, but conceptually, the user doesn't want to go to the login form, he want the "home" view..
[11:32am] oranheim: maschmid: hmm… i haven't thought about that.. if we remove the faces-config nav-rule, request e.g. /home.xhtml (which is protected) that will redirect the user to the login.xhtml view and from there the user will be redirect to home after logon

                
      was (Author: oranheim):
    There's a bit of doubt (from my side at least) to what should be the expected behavior. Below is an seam-dev chat snippet to shed light on topic.

{noformat}
[09:59am] oranheim: maschmid: i do see you point with #1, so it's not a bug. It's correct behaviorr
[09:59am] oranheim: maschmid: but, what is the correct faces-config.xml configuration then. Because, you need to have a identity.login rule in order to redirect the user during normal login.. I'm a bit confused here
[11:14am] maschmid: oranheim, I agree with you that there should be a way to tell it to redirect somewhere else if you go to the login page explicitly... I don't think it is possible right now to do it in any clean way... currently it seems that the only way is to make the "login" button go to "home" or whatever view you want to end up after the successful login..
[11:16am] maschmid: we should probably ask bleathem what he thinks about this...
[11:17am] oranheim: maschmid: Marek, that is not a satisfactory solution, because it violates with the principles of @ViewConfig where you declare restricted views. So, it will make that great feature unusable. It's in fact such a blocker, that my company can't upgrade and move on to the next level.. Let's discuss this with Brian
[11:18am] oranheim: maschmid: Re issue #1. Using @Initialed HttpServletResponse works just fine in my app now
[11:29am] maschmid: oranheim, I still don't quite understand why you need to go to the login page explicitly... isn't the point of the @LoginView to automatically redirect you to the login view whenever you need? (now of course the button in the UI will probably be labeled "login" as that is what the user expects, but conceptually, the user doesn't want to go to the login form, he want the "home" view..
[11:32am] oranheim: maschmid: hmm… i haven't thought about that.. if we remove the faces-config nav-rule, request e.g. /home.xhtml (which is protected) that will redirect the user to the login.xhtml view and from there the user will be redirect to home after logon
{noformat}
                  
> @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