Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5970355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:21:48+00:00 2026-05-22T20:21:48+00:00

In the web service I’m working on, I need to implement a URI with

  • 0

In the web service I’m working on, I need to implement a URI with query parameters which look like /stats?store=A&store=B&item=C&item=D

To break it down, I need to be able to use query parameters to specify data from multiple/all stores and data for multiple/all items from those stores. So far I have been able to implement one query argument just fine in order to pull item data, but I’m lost as far as to how to implement more queries, and can’t seem to find the resources I had seen before which deal with this implementation.

What I have so far in my method is along the lines of

@GET
@Path("stats")
public String methodImCalling(@DefaultValue("All") @QueryParam(value = "item") final String item)
{
    /**Run data using item as variable**/
    return someStringOfData
}

which works well for one item, and will return all data if I don’t type the parameter in the URI. However, I am unsure how to handle any more parameters than this.

Update:

I have figured out how to use 2 different parameters by simply adding a second argument to the method like so:

public String methodImCalling(@DefaultValue("All") @QueryParam(value = "store") final String store,
    @DefaultValue("All") @QueryParam(value = "item") final String item)

The question remains of how to implement multiple values of the same parameter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:21:48+00:00Added an answer on May 22, 2026 at 8:21 pm

    If you change the type of your item method parameter from String to a collection such as List<String>, you should get a collection that holds all the values you are looking for.

    @GET
    @Path("/foo")
    @Produces("text/plain")
    public String methodImCalling(@DefaultValue("All") 
                                  @QueryParam(value = "item") 
                                  final List<String> item) {
       return "values are " + item;
    }
    

    The JAX-RS specification (section 3.2) says the following regarding the @QueryParam annotation:

    The following types are supported:

    1. Primitive Types
    2. Types that have a constructor that accepts a single String argument.
    3. Types that have a static method named valueOf with a single String argument.
    4. List<T>, Set<T>, or SortedSet<T> where T satisfies 2 or 3 above.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My web service method returns a Page object which includes the following methods: public
My web service (wcf) stopped working all of a sudden. I compared my web.config
I have a WCF Web Service which is referenced from a class library. After
The web service that I want to run on AWS has to store and
The web service has SoapExtension, which contains an error handler and serializing error in
Given a public SOAP web service and no WSDL, I need to build a
I have a web service call that returns XML which I convert into domain
I'm building a web service which takes credentials for other services and polls these
Web service error response (code/message etc) would you store it in a database? or
SOAP Web Service: do you need the WSDL publication page? Can I remove the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.