Skip to content

Add support for multipart and @FormParam annotation #444

@jamfor999

Description

@jamfor999

Expected Behavior

@FormParam should not be transposed to @QueryValue in a multipart endpoint.

As per https://jakarta.ee/specifications/restful-ws/3.1/jakarta-restful-ws-spec-3.1.html#consuming_multipart_formdata:

@Path("widgets4")
public class WidgetsResource4 {

    @POST
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response postWidget(@FormParam("part1Name") String part1,
                               @FormParam("part2Name") InputStream part2,
                               @FormParam("part3Name") EntityPart part3) {...}
}

@FormParam represents a part of a Multipart request, not a QueryValue. But, here, the code is translating it to @QueryValue - this is wrong and will break HTTP clients.

Actual Behaviour

The above snippet should work correctly, with the @FormParam values being interpreted as part of the multipart form, not as query parameters.

Steps To Reproduce

  1. Write a JAX-RS controller which uses @FormParam to indicate multipart form data
  2. Test, it will break

Environment Information

No response

Example Application

I cannot provide a sample application right now as this was noticed in an enterprise setting.

Version

4.4.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions