0

I tried something like below, M getting error [[FATAL] No injection source found for a parameter of type public Response @context UriInfo wont work as i need different data types as query param,like it may be integers and date.Kindly Help.

@GET
@Path("/getdetails")
@Produces({ "application/json", "application/xml" })
public Response getDetails(@QueryParam("field1") String  fieldOne,@QueryParam("field2") List<HasMap<String,String>> fieldTwo){
        //Processing
        }
Vinay
  • 11
  • 4
  • you may check this - http://stackoverflow.com/questions/8413608/sending-list-map-as-post-parameter-jersey – Razib Jan 23 '17 at 14:22

1 Answers1

0

You will have to use POST and attach the list inside the request body

If the list your passing is json, you should also add the appropriate @Consumes value.

@POST
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
@Consumes(MediaType.APPLICATION_JSON)
public void getDetails(List<HasMap<String,String>> listFromClient) {
    // do something with your list..
}
svarog
  • 9,477
  • 4
  • 61
  • 77
  • Thanks a lot for your answer. Is there any way to do the same in GET request. – Vinay Jan 24 '17 at 05:39
  • you can't pass a body with a GET request, which mean no `List<..>` as argument. you could pass the data as a url path param or a query param but that's not how jersey/ws are done – svarog Jan 24 '17 at 07:10
  • Thank you so much. – Vinay Jan 24 '17 at 07:19