I want to PUT, via binary, to an endpoint that can consume one of many possible mimetypes. Specifically, I am communicating with an Apache Tika server, which could take, say, a PDF or a Word .docx file.
I've set up a client proxy interface that I can hardcode, say, the .docx mimetype:
public interface TikaClient {
@PUT
@Path("tika")
@Consumes("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
Response putBasic(byte[] body);
}
And this will work when I call it:
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target(url);
TikaClient tikaClient = target.proxy(TikaClient.
Response response = tikaClient.putBasic(binaryFileData);
....But that endpoint specifically could also take a "text/plain" or "application/pdf".
I believe I can specify multiple @Consumes options: @Consumes({"text/plain", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"})
But it doesn't seem to pick the right one, and I don't know how to tell it which one the file in question is.