ResponseHandler implements IResponseHandler { public void onResponse(IHttpResponse response) throws IOException { status = response.getStatus(); ... } public void void onException(IOException ioe) { ... } }
531532533534535536537538539540541
request.removeHeader("Authorization"); request.setHeader("X-Authentication", authtoken); IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { exchange.send(response); }
623624625626627628629630631632633
IHttpRequest req = exchange.getRequest(); requestString.append(req.getRequestHeader().toString()); IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { // does request contain a body? if (response.hasBody()) {
713714715716717718719720721722723
IHttpRequest req = exchange.getRequest(); req.addHeader("X-Received", new Date().toString()); IHttpResponseHandler responseInterceptor = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { response.addHeader("X-Sent", new Date().toString()); exchange.send(response); }
742743744745746747748749750751752
this.shift = shift; } public void onRequest(final IHttpExchange exchange) throws IOException { IHttpResponseHandler responseInterceptor = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { if (response.hasBody()) {
857858859860861862863864865866867
String authtoken = authenticator.login(userPasswordPair[0], userPasswordPair[1]); request.removeHeader("Authorization"); request.setHeader("X-Authentication", authtoken); IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { exchange.send(response); }
7576777879808182838485
public void onRequest(final IHttpExchange exchange) throws IOException { PostRequest newRequest = new PostRequest(exchange.getRequest().getRequestUrl().toString(), "text/plain", "Hello"); IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { exchange.send(response); }
138139140141142143144145146147148
IHttpRequestHandler filter = new IHttpRequestHandler() { public void onRequest(final IHttpExchange exchange) throws IOException { IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { exchange.send(response); }
195196197198199200201202203204205
IHttpRequestHandler filter = new IHttpRequestHandler() { public void onRequest(final IHttpExchange exchange) throws IOException { IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { HttpResponse newResponse = new HttpResponse(200, "text/plain", "Hello You"); exchange.send(newResponse);
256257258259260261262263264265266
IHttpRequestHandler filter = new IHttpRequestHandler() { public void onRequest(final IHttpExchange exchange) throws IOException { IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { BodyDataSink bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain")); bodyDataSink.write("Hello");
329330331332333334335336337338339
IHttpRequestHandler filter = new IHttpRequestHandler() { public void onRequest(final IHttpExchange exchange) throws IOException { IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { BodyDataSink bodyDataSink = exchange.send(new HttpResponseHeader(200, "text/plain"), 9); bodyDataSink.write("Hello");