Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: [SOLVED] method selection in apache cxf with queryParam

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    15
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Default [SOLVED] method selection in apache cxf with queryParam

    I created a java rest resource with 2 methods both listening on the same path, but one with @QueryParam annotation as method parameter

    @Path("test")
    public class TestResource {
     
        @GET
        public Response filter(){  
            System.out.println("init");
            return Response.accepted("Hello world").build();
        }
     
        @GET    
        public Response filterQuery(@QueryParam("filter") String filterQuery) {
            return Response.accepted("filter: " + filterQuery).build();
            //... parsing filter
        } 
    }
    But when I try GET on
    ../test?filter=name:Juraj;location:Slovakia
    or on
    ../test
    it is always calling the filter() method

    Is it not enough to define the QueryParam to get the second method be called? I would like to offer the user to parametrize on the same url, not on the
    /test/filter?name=...

    Can I do this somehow? Using apache-cxf 3.0.0-milestone2
    Last edited by Zavael; May 16th, 2014 at 06:12 AM. Reason: taged as solved


  2. #2
    Junior Member
    Join Date
    Apr 2014
    Posts
    15
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Default Re: method selection in apache cxf with queryParam

    I realized that i just need to check for filterQuery presence in the filterQuery method (if it is not null). Thats all.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,388
    My Mood
    Mellow
    Thanks
    143
    Thanked 599 Times in 586 Posts

    Default Re: [SOLVED] method selection in apache cxf with queryParam

    Thanks for the update.

Similar Threads

  1. selection sorting help?
    By namenamename in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 2nd, 2013, 04:11 PM
  2. Help with Course Selection
    By randy81 in forum The Cafe
    Replies: 4
    Last Post: August 14th, 2013, 03:51 AM
  3. Selection with a for loop
    By sowmyad96 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 26th, 2012, 08:21 AM
  4. java.lang.NoSuchMethodError in webserice with CXF
    By jammychen in forum Java Theory & Questions
    Replies: 1
    Last Post: September 22nd, 2010, 02:56 PM
  5. Selection Sorting
    By chronoz13 in forum Algorithms & Recursion
    Replies: 5
    Last Post: December 10th, 2009, 10:08 AM

Tags for this Thread