java - Retrieving query parameters in order in JAX-RS UriInfo -
in jax-rs need iterate (arbitrary) given query parameters in request... in original order in uri!
if inject @context uriinfo uriinfo
can use uriinfo.getqueryparameters()
multivaluedmap
of query parameters, grouped query parameter name. if care original order of query parameters? there way iterate name/value pairs? or must extract them manually uriinfo.getrequesturi()
?
if i'm stuck manual extraction, there standard or well-maintained , updated library can use doing this?
custom solution apache httpclient library:
public void process(@context uriinfo uriinfo) { string querystring = uriinfo.getrequesturi().getquery() //todo: extract charset content-type header, if present list<namevaluepair> queryparams = urlencodedutils.parse(querystring, "utf-8") for(namevaluepair param : queryparams) { //do need } }
Comments
Post a Comment