5 Replies Latest reply on Nov 28, 2013 12:56 AM by Nikhil Raj

    QueryParam in Errai JAXRS

    Nikhil Raj Newbie

      Hi

       

      I am trying to invoke the REST service shown below using Errai (2.3.2.Final) via Injection of a caller proxy

       

           @GET
          @Path("/data.json")
          public Response getJson(@QueryParam("id") List<String> idList);
      
      
      

       

      However, when I pass in a list of Strings containing [abc, xyz], Errai tries to hit the service using the URL '.../data.json?id=[abc, xyz]' instead of '.../data.json?id=abc&id=xyz'.

      Is this a bug or am I missing something here?

        • 1. Re: QueryParam in Errai JAXRS
          Christian Sadilek Master

          Hi!

           

          No, you're not missing something. I've missed to implement/test this feature. Here's the JIRA:

          [ERRAI-673] Errai JAX-RS does not support List/Set/SortedSet as resource method parameters - JBoss Issue Tracker

           

          If you want to take a stab at it and send a pull request you're more than welcome. We'll try to implement it for the next release (~ Dec. 10).

           

          Thanks,

          Christian

          1 of 1 people found this helpful
          • 2. Re: QueryParam in Errai JAXRS
            Christian Sadilek Master

            This should work now with the latest 3.0- and 2.4.3-SNAPSHOTs.

             

            Cheers,

            Christian

            • 3. Re: Re: QueryParam in Errai JAXRS
              Nikhil Raj Newbie

              Thanks Christian!

               

              Unfortunately, I am unable to test the fix as I get the compilation errors given below when I try to use 2.4.3-SNAPSHOT

               

              Caused by: java.lang.ClassCastException: org.jboss.errai.enterprise.rebind.JaxrsResourceMethodParameters$1 cannot be cast to org.jboss.errai.codegen.Parameter

                  at org.jboss.errai.enterprise.rebind.JaxrsProxyMethodGenerator.generateUrl(JaxrsProxyMethodGenerator.java:152)

                  at org.jboss.errai.enterprise.rebind.JaxrsProxyMethodGenerator.generateInterceptorLogic(JaxrsProxyMethodGenerator.java:301)

                  at org.jboss.errai.enterprise.rebind.JaxrsProxyMethodGenerator.generate(JaxrsProxyMethodGenerator.java:94)

                  at org.jboss.errai.enterprise.rebind.JaxrsProxyGenerator.generate(JaxrsProxyGenerator.java:77)

                  at org.jboss.errai.enterprise.rebind.JaxrsProxyLoaderGenerator.generate(JaxrsProxyLoaderGenerator.java:67)

                  at org.jboss.errai.config.rebind.AbstractAsyncGenerator$1.call(AbstractAsyncGenerator.java:42)

                  at org.jboss.errai.config.rebind.AbstractAsyncGenerator$1.call(AbstractAsyncGenerator.java:39)

                  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

               

              and

              Caused by: java.lang.NoClassDefFoundError: org.jboss.errai.enterprise.client.jaxrs.JaxrsProxyLoaderImpl

                  at com.google.gwt.dev.jjs.impl.UnifyAst.searchForTypeBySource(UnifyAst.java:981)

                  at com.google.gwt.dev.jjs.impl.UnifyAst.access$1500(UnifyAst.java:120)

                  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleGwtCreate(UnifyAst.java:364)

                  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.handleMagicMethodCall(UnifyAst.java:433)

                  at com.google.gwt.dev.jjs.impl.UnifyAst$UnifyVisitor.endVisit(UnifyAst.java:237)

                  at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:243)

                  at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)

                  at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)

               

              Could you please point me in the right direction here?

               

              Cheers,

              Nikhil

              • 4. Re: QueryParam in Errai JAXRS
                Christian Sadilek Master

                Thanks for testing this so quickly. The fix caused the interceptor code generation to fail. I published new SNAPSHOTs now. Can you give this another try?

                 

                Thanks,

                Christian

                • 5. Re: Re: QueryParam in Errai JAXRS
                  Nikhil Raj Newbie

                  Thanks a lot Christian!

                  It works like a charm now.

                   

                  Regards,

                  Nikhil