java - Copy/Clone Response object -
i tried copy response object of jax-ws.
the client tries download pdf file request forwarded kind of proxy. proxy calls target server uses rest well. server returns pdf file, mediatype "application/pdf" , entity body. point of view best way forward message. following solution not work. see pdf if requested not forwarded client.
@get @path("invoices/{invoiceid}") public response forwardinvoice(@pathparam("invoiceid") long invoiceid) { return service.connect().downloadinvoice(invoiceid); }
this solution work 200 ok + body not 404 not found.
@get @path("invoices/{invoiceid}") public response forwardinvoice(@pathparam("invoiceid") long invoiceid) { final response response = service.connect().downloadinvoice(invoiceid); return response.status(response.getstatus()).type(response.getmediatype()).entity(readentity(response)).build(); }
the method readentity changes input stream byte array.
i didn't want add logic, copying/forwarding. there easy way solve it?
thanks, clueless
Comments
Post a Comment