Home JAX-RS Mixing @FormParam and MultivaluedMap<String, String> formParams

# JAX-RS Mixing @FormParam and MultivaluedMap<String, String> formParams

user6017
1#
user6017 Published in September 19, 2018, 9:49 am

I've a method that returns all records sons of a father record (document and rows for example):

public Datasource<Son> getSonsFromParent( @FormParam(value = "idparent") Long idparent,
MultivaluedMap<String, String> formParams) throws Exception;


I've a well known parameter, "idparent". I want to get this parameter simply using @FormParam . It's useful for exposing this method to other people: they know that a "idparent" is required.

Also, I have a number of undefined parameters for sorting and filtering my datasource, for example

 sort[0]=name

sort[1]=surname

filter[0][field]=name

filter[0][operator]=equal

filter[0][value]=Marc


The problem is : using @FormParam, the multivalue map is always empty.

How can i mix MultivaluedMap and @FormParam together ?

• Take a look here. It is an answer that can fit your needs. stackoverflow.com/questions/8413608/… – Mario Apr 18 at 17:36