1d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen/* 2d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * Copyright 2009 Mike Cumings 3d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * 4d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * Licensed under the Apache License, Version 2.0 (the "License"); 5d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * you may not use this file except in compliance with the License. 6d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * You may obtain a copy of the License at 7d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * 8d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * http://www.apache.org/licenses/LICENSE-2.0 9d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * 10d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * Unless required by applicable law or agreed to in writing, software 11d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * distributed under the License is distributed on an "AS IS" BASIS, 12d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * See the License for the specific language governing permissions and 14d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * limitations under the License. 15d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen */ 16d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen 17d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chenpackage com.kenai.jbosh; 18d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen 19d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen/** 20d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * This class represents a complete HTTP response to a request made via 21d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * a {@code HTTPSender} send request. Instances of this interface are 22d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * intended to represent a deferred, future response, not necessarily a 23d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * response which is immediately available. 24d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen */ 25d7955ce24d294fb2014c59d11fca184471056f44Shuyi Cheninterface HTTPResponse { 26d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen 27d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen /** 28d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * Close out any resources still held by the original request. The 29d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * conversation may need to be aborted if the session it was a part of 30d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * gets abruptly terminated. 31d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen */ 32d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen void abort(); 33d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen 34d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen /** 35d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * Get the HTTP status code of the response (e.g., 200, 404, etc.). If 36d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * the response has not yet been received from the remote server, this 37d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * method should block until the response has arrived. 38d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * 39d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * @return HTTP status code 40d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * @throws InterruptedException if interrupted while awaiting response 41d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen */ 42d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen int getHTTPStatus() throws InterruptedException, BOSHException; 43d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen 44d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen /** 45d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * Get the HTTP response message body. If the response has not yet been 46d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * received from the remote server, this method should block until the 47d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * response has arrived. 48d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * 49d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * @return response message body 50d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen * @throws InterruptedException if interrupted while awaiting response 51d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen */ 52d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen AbstractBody getBody() throws InterruptedException, BOSHException; 53d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen 54d7955ce24d294fb2014c59d11fca184471056f44Shuyi Chen} 55