Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MultivaluedMapImpl() with Jersey 2.9

I'm trying to create key-value pair using MultivaluedMap (Jersey 2.9 in Eclipse) but somehow it is not able to find MultivaluedMapImpl(). What implementation of MultivaluedMap can I use?

Thanks.

Client client = ClientBuilder.newClient();
WebTarget webtarget =client.target("http://localhost:8080").path("/usr/home/create/");


MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.add("xyz", abc);
like image 407
Ios mx Avatar asked Oct 20 '25 02:10

Ios mx


2 Answers

You can use MultivaluedStringMap class which extends javax.ws.rs.core.MultivaluedHashMap<java.lang.String, java.lang.String>

like image 53
herau Avatar answered Oct 21 '25 15:10

herau


For Jersey 2.0, query parameters can be defined while declaring WebTarget using WebTarget.html.queryParam(String, Object...)

There seems to be no need for MultivaluedMapImpl or MultivaluedHashMap.

like image 42
Ios mx Avatar answered Oct 21 '25 17:10

Ios mx