users@jersey.java.net

[Jersey] POST resource with multiple parameters and InputStream

From: Behrooz Nobakht <nobeh5_at_gmail.com>
Date: Tue, 8 Apr 2014 08:38:59 +0200

Hi,

Consider the following resource endpoint:

@POST
public Response post(String p1, String p2, InputStream p3) { ... }

I want to have a POST resource endpoint that has a number parameters
including one instance of InputStream.
I may be similar to file upload examples; however, the InputStream
parameter is not a file upload (e.g. a byte array or an object
serialization).
I have tried using FormParam and media type
application/x-www-form-urlencoded, application/octet-stream,
multipart/form-data. However, I get an error:

No injection source found for a parameter

for the parameter of type InputStream. It is
documented<https://jersey.java.net/documentation/latest/message-body-workers.html#d0e6226>that
InputStream is supported by default.

What is the correct method signature and reader/writers that I need to have
to define such resource endpoint?

Thanks in advance,
Behrooz