ResponseHandler implements IResponseHandler { public void onResponse(IHttpResponse response) throws IOException { status = response.getStatus(); ... } public void void onException(IOException ioe) { ... } }
7172737475767778798081
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); }
130131132133134135136137138139140
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); }
194195196197198199200201202203204
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);
254255256257258259260261262263264
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");
326327328329330331332333334335336
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");
533534535536537538539540541542543
request.removeHeader("Authorization"); request.setHeader("X-Authentication", authtoken); IHttpResponseHandler respHdl = new IHttpResponseHandler() { public void onResponse(IHttpResponse response) throws IOException { exchange.send(response); }
615616617618619620621622623624625
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()) {
705706707708709710711712713714715
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); }
734735736737738739740741742743744
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()) {
849850851852853854855856857858859
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); }