0
第三方服务正在使用HttpClient(3.1)来获取我通过Jersey(在tomcat上)提供的url。它将错误抛诸脑后。违反协议:块大小中意外的单个换行符
这是我所服务的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();
}
}
是否有办法来解决此问题?
确保Jersey使用CRLF('\ r \ n')终止行而非空行。 – oldrinb
你知道吗? (顺便说一句,我认为这是一个Tomcat问题)。 – IttayD