ResponseHandler implements IResponseHandler { public void onResponse(IHttpResponse response) throws IOException { status = response.getStatus(); ... } public void void onException(IOException ioe) { ... } }
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); }
10431044104510461047104810491050105110521053
public void onRequest(final IHttpExchange exchange) throws IOException { httpRequest = exchange.getRequest(); onRequestThreadname = Thread.currentThread().getName(); 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); }
137138139140141142143144145146147
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); }
193194195196197198199200201202203
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);
253254255256257258259260261262263
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");
325326327328329330331332333334335
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");