Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/390.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 这是显示图像的方式吗?_Java_Ruby_Rest - Fatal编程技术网

Java 这是显示图像的方式吗?

Java 这是显示图像的方式吗?,java,ruby,rest,Java,Ruby,Rest,我为我的同事设计了一个图像处理API。他使用Ruby(RestClient)作为客户端 $ curl -i -X GET http://abc.com:8080/api/v0/compare-19 HTTP/1.1 303 See Other Date: Thu, 10 Jan 2013 08:02:02 GMT Content-Type: application/json Location: http://abc.com:8080/result/856caf71-df10-4b9e-a981-

我为我的同事设计了一个图像处理API。他使用Ruby(RestClient)作为客户端

$ curl -i -X GET http://abc.com:8080/api/v0/compare-19
HTTP/1.1 303 See Other
Date: Thu, 10 Jan 2013 08:02:02 GMT
Content-Type: application/json
Location: http://abc.com:8080/result/856caf71-df10-4b9e-a981-4785de2f4854.png
Transfer-Encoding: chunked
Server: Jetty(8.1.3.v20120416)

{
    "id": 19,
    "state": "completed",
    "timestamp": "2013-01-10T00:01:13.755-08:00",
    "resultImage": "856caf71-df10-4b9e-a981-4785de2f4854.png",
    "passcode": "AXBD"
}
他想捕获“状态”和“密码”,但根据RESTClient文档,ruby程序立即重定向到

Exceptions (see www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)
for results code between 200 and 207 a RestClient::Response will be returned
for results code 301, 302 or 307 the redirection will be followed if the request is a get or a head
for result code 303 the redirection will be followed and the request transformed into a get
for other cases a RestClient::Exception holding the Response will be raised, a specific exception class will be thrown for know error codes

我的问题是,这是给出REST响应的正确方式吗

我认为如果您将URL留在
http://abc.com:8080/api/v0/compare-19
为200 OK响应,无需重定向。将响应的resultImage设置为图像的相对/绝对URL。然后,客户机可以获取有关操作的元数据,如果希望获得最终结果图像,则可以遵循resultImage URL