A 3rd party service is using HttpClient (3.1) to GET a url that I’m serving through Jersey (on tomcat). It is throwing the error in the subject.
This is how I serve the URL:
@Path("somepath")
@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response download(@Context UriInfo uriInfo) {
try {
URL url = // find the actual URL (a file)
InputStream stream = url.openStream();
return Response.ok(stream).build();
} catch (IOException e) {
return Responses.notFound().build();
}
}
Is there a way to work around this?
I ended up doing something like this:
Which works for my use case.
Some notes: