jax rs - Uploading a file via Jaxax REST Client interface, with third party server -
i need invoke remote rest interface handler , submit file in request body. please note i don't control server. cannot change request multipart, client has work in accordance external specification.
so far managed make work (omitting headers etc. brevity):
byte[] data = readfilecompletely (); client.target (url).request ().post (entity.entity (data, "file/mimetype"));
this works, fail huge files don't fit memory. , since have no restriction on filesize, concern.
question: somehow possible use streams or similar avoid reading whole file memory?
if possible, i'd prefer avoid implementation-specific extensions. if not, solution works resteasy (on wildfly) acceptable.
reasteasy jersey support inputstream out of box use entity.entity(inputstream, "application/octet-stream");
or whatever content-type header want set.
Comments
Post a Comment