Expand Map as separate form parameters inside @MultipartForm POJO

A server consumes a multipartform-data with several static parameters and some dynamically defined "directives" which names are unknown at the compile time and wich are sent as standalone form parameters.

I have a client method in the interface


@Path ("/send")

@Consumes (MediaType.MULTIPART_FORM_DATA)

void send(@MultipartForm SendPTO sendPTO);

And SendPto consists of statically defined parameters and I want to put there a Map with dynamic directives

public class SendPTO


@FormParam ("fileType")

@PartType ("text/plain")

private String fileType;

@FormParam ("charset")

@PartType ("text/plain")

private String charset;



@PartFilename ("file")

private InputStream file;

@ExpandAsParameters /*not real annotation*/

private Map directives;



When I annotate directives as @FormParam it is deserialized as json, without annotation...

Read More »

By: StackOverFlow - Friday, 13 April

Related Posts