I think you can invoke a POST request with Entity, which encapsulates binary data as follows:
Client client = ClientBuilder.newClient(); WebTarget webTarget = client.target("http://example.com/rest"); Response response = webTarget.request(MediaType.TEXT_PLAIN_TYPE) .post(Entity.entity("abc", MediaType.APPLICATION_OCTET_STREAM));
source share