No injection source found for multipart feature working with gradle

Viewed 14

I downloaded the Traccar open source code. I want to be able to use @FormDataParam, so I imported this dependency in my build.gradle and use it as follows. If I only send one @FormDataParam field, it receives it, but if I send two, I get the error "No injection source found for a parameter of type public javax.ws.rs.core.Response". I read in this guide that I need to register MultiPartFeature, but I don't know exactly in which files it should be put, could someone help me? I saw this, but I don't use Maven. MULTIPART_FORM_DATA: No injection source found for a parameter of type public javax.ws.rs.core.Response

I don't have a web.xml.

https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/media.html#multipart

build.gradle

dependency{
   ...
   implementation "com.sun.jersey.contribs:jersey-multipart:1.18.2"
}

BaseObjectDeviceResource.java

import com.sun.jersey.multipart.FormDataParam;

....

    @POST
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response add(
                         @FormDataParam("file") String file
    ) throws StorageException {

        System.out.println("\n"+file);
        return Response.ok().status(200).build();

    }
0 Answers
Related