In default functions I can use ContainerRequestContext requestCtx
to get the securitycontext and username from the request.
But for some reason when using this in a function that consumes MediaType.MULTIPART_FORM_DATA
I'm getting this error:
org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization.
Code:
@POST
@Path("{albumcode}")
@RolesAllowed("user")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadPicture(@PathParam("code") String code,
FormDataMultiPart multipart,
ContainerRequestContext requestCtx) {
Without ContainerRequestContext requestCtx
the code from above works just fine.
Whats the best way to get the data from my ContainerRequestContext
and also being able to upload files at the same time?