5 Replies Latest reply on Mar 19, 2007 7:02 PM by fhh

    BUG: #{redirect.returnToCapturedView} does not work with @Re

    fhh Expert

      Hello!

      I have a page action that calls a method that is protected by @Restrict and reads the parameters with @RequestParameters. If I access the page the login page comes up.

      After a succesful login I am redirected to the original page thanks to #{redirect.returnToCapturedView} but then the protected method fails because of a NPE. The field that is annotated with @RequestParameter is not set.

      Regards

      Felix

        • 1. Re: BUG: #{redirect.returnToCapturedView} does not work with
          Gavin King Master

          Yes, only page parameters are captured. Use a page parameter instead of @RequestParameter.

          • 2. Re: BUG: #{redirect.returnToCapturedView} does not work with
            fhh Expert

             


            Use a page parameter instead of @RequestParameter.


            This will not work for me as I am using RESTful model where all data is passed in from another site.

            Will this bug (?) be fixed in later releases? I guess the problem is that the request parameter map is immutable. Is that true? If so would it possible to add a fake request parameter map to which the capture view method will copy the real request parameters and that is also searched by interceptor?

            And if this will not be fixed, what is the suggested workareound? Should I just add a wrapper class that moves the request parameter to the page parameters before calling the @Restrict method?

            Thanks for any answers :-)

            Regards

            Felix

            • 3. Re: BUG: #{redirect.returnToCapturedView} does not work with
              Christian Bauer Master

               


              This will not work for me as I am using RESTful model where all data is passed in from another site.


              Why not? A page parameter is just an automatically applied request parameter, effectively the same as @RequestParameter on a property setter method.


              • 4. Re: BUG: #{redirect.returnToCapturedView} does not work with
                fhh Expert

                Oops, sorry. I haven't read up on all the new features of seam. I thought you meant a page scoped parameter component.

                Looking at the documentation now I think this should work for me. I will test and report back.

                Thanks

                Felix

                • 5. Re: BUG: #{redirect.returnToCapturedView} does not work with
                  fhh Expert

                  Still no luck... This seems to be a bug! I switched to page params but still the parameter is nul,l after a returning to the captured view.

                  I ran this through the debugger and traced the bug down to org.jboss.seam.core.Pages.getViewRootValues(FacesContext facesContext). Things go wrong when retriving the page parameters:

                   for ( Param pageParameter: page.getParameters() )
                   {
                   Object object = Contexts.getPageContext().get( pageParameter.getName() );
                   if (object!=null)
                   {
                   parameters.put( pageParameter.getName(), object );
                   }
                   }
                  


                  It loops correctly over my parameters but it fails to retrieve them: pageParamter.getName() delivers the correct string but Contexts.getPageContext().get() returned null. So nothing is ever put into the parameters map.

                  I tried to trace it any further but it was beyond my knowledge of JSF to get to the bottom of the problem. If you need more info please let me know.

                  Regards

                  Felix