{
int statusCode = exchange.getResponseStatus();
String statusMessage = exchange.getResponseMessage();
Map<String, String> responseHeaders = exchange.getResponseHeaders();
byte[] responseBody = exchange.getResponseBody();
RHTTPResponse response = new RHTTPResponse(request.getId(), statusCode, statusMessage, responseHeaders, responseBody);
client.deliver(response);
}
else
{
int statusCode = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
String statusMessage = "Gateway error";
HashMap<String, String> responseHeaders = new HashMap<String, String>();
responseHeaders.put("Connection", "close");
byte[] responseBody = new byte[0];
RHTTPResponse response = new RHTTPResponse(request.getId(), statusCode, statusMessage, responseHeaders, responseBody);
client.deliver(response);
}
}