How RestFul (Jersey implementation) Gets the parameters of the Get API

Source: Internet
Author: User

1: General Parameters

Example: An API Url to get a list of users

var url = appcontextpath + "/rest/users?page=" +page+ "&per_page=" +per_page+ "&name=" +txtname+ "&sortby=" + Currentsortfield+ "&order=" + currentsortorder;

Parameter acquisition method: @QueryParam ("Paramname")


2: Range parameter

For example: Get user data registered from 2015-01-01 to 2015-01-10 time period

var url = appcontextpath + "/rest/users?start >= 2015-01-01&start <= 2015-01-10

Get method:


multivaluedmap<string, string> map =ui.getqueryparameters ();
String start1 = null;
String start2 = null;
if (Map.get ("start")! = null && map.get ("Start"). Size > 0) {
Start1 = Map.get ("Start"). Get (0);
}
if (Map.get ("start")! = null && map.get ("Start"). Size > 1) {
Start2 = Map.get ("Start"). Get (1);
}


How RestFul (Jersey implementation) Gets the parameters of the Get API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.