How Jersey 2 Client can send Input/Output binary stream to Server and Vise Versa
This Question and its answers solved my problem. In the answers, InputStreams were used. They worked well, but I had to do some modifications to make them work for Jersey 2.8. Also, Instead of stream, direct byte [] also can be used. I tested and it worked well. Big thank to Martin Wilson and sikrip .
Jersey: Get binary data from post request
Answering myself...
It is very simple, the removal of @Consumes(MediaType.APPLICATION_OCTET_STREAM)
solved the problem
Jersey Client post binary data application-octet/stream
I think you can invoke a POST request with Entity which encapsulates binary data like this:
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));
Form file uploads in jersey-client 1.18
I think this has already been answered. You should be using FormDataMultiPart
Jersey REST Client : Posting MultiPart data
Related Topics
Wait Until Firebase Retrieves Data
Calculate Difference Between Two Times in Android
Http Get Using Android Httpurlconnection
Variable Length (Dynamic) Arrays in Java
Collections Sort(List<T>,Comparator<? Super T>) Method Example
How to Save Image File in Android Oreo Update. How to Do It
How to Parse This JSON in Android
Android: Realm + Retrofit 2 + Gson
Convert Unix Timestamp to Date in Java
How to Implement Enum with Generics
Difference Between Actionbarsherlock and Actionbar Compatibility
Android - Prevent White Screen at Startup
How to Get the Fields in an Object via Reflection
How Big Is an Object Reference in Java and Precisely What Information Does It Contain