5 Replies Latest reply on Sep 29, 2009 2:49 AM by cpopetz

    RequestParameter in Wicket

    robshep

      Is there a way to harness RequestParameters in a Seam/Wicket application.




      @RequestParameter 
      Long entityID





      results in a



      java.lang.IllegalStateException: No FacesContext associated with current thread, cannot convert request parameter type

        • 1. Re: RequestParameter in Wicket
          cpopetz

          Nope, not implemented.  Feel free to file a jira issue feature request.

          • 2. Re: RequestParameter in Wicket
            robshep

            Thanks Clint, will do a jira item.


            How difficult is this likely to be? I'd be willing to have a crack at this.


            I'd need pointing in the right direction first....


            Cheers and regards


            Rob

            • 3. Re: RequestParameter in Wicket
              cpopetz

              I presume you mean injecting request parameters into fields of wicket components, not into other seam components.  The latter should already work, even under wicket, as long as the types of the injected fields is String because otherwise you won't have access to the JSF converters, and that code (org.jboss.seam.web.Parameters) is tied to jsf.


              For making injection of request parameters work for wicket components, you'd need to do the following in org.jboss.seam.wicket.WicketComponent:


              add a list of BijectedAttributes for fields that are annotated with RequestParameter, similar to inAttributes
              in add(Field), add to that list if a field is annotated
              in initInterceptors(), add a new RequestParameterInterceptor if that list is non-empty
              code that interceptor to do something similar to what BijectionInterceptor and WicketComponent.inject does for request parameters.



              For what it's worth, I'd accept a patch on all that, but I'm not going to code it all, because all of this changes under Seam3, which uses JSR-299, and which will support wicket OOTB because it's less tied to JSF and better implemented.

              • 4. Re: RequestParameter in Wicket
                robshep

                Clint,


                Your second sentence has been the most useful thing  I've read in the last few days!
                I just wish I'd read it sooner, and saved a day and a half of fruitless hacking :)


                Is this documented somewhere? Maybe this is a truth nugget for an KnowledgeBase somewhere.



                I'll look forward to Seam3, instead of coding the above...


                Thanks for the tip!


                Rob

                • 5. Re: RequestParameter in Wicket
                  cpopetz

                  FWIW, I don't think that the restriction in question (i.e. that @RequestParameter should work in seam components when running with wicket, but not for types other than String) is documented anywhere.