System.setProperty("org.xlightweb.showDetailedError", "true");
RequestHandlerChain chain = new RequestHandlerChain();
IHttpRequestHandler rh = new IHttpRequestHandler() {
public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
IHttpRequest request = exchange.getRequest();
BodyDataSink dataSink = exchange.forward(request.getRequestHeader());
dataSink.write("addedLine\r\n");
dataSink.write(request.getBlockingBody().readString());
dataSink.close();
}
};
chain.addLast(rh);
IHttpRequestHandler rh2 = new IHttpRequestHandler() {
public void onRequest(IHttpExchange exchange) throws IOException, BadMessageException {
IHttpRequest request = exchange.getRequest();
exchange.send(new HttpResponse(200, request.getBlockingBody().readString()));
}