/* -------------------- AsyncRequestHandler Interface --------------------- */
  public void handle(Message request, Response response) throws Exception {
    if (req_handler != null) {
      if (req_handler instanceof AsyncRequestHandler)
        ((AsyncRequestHandler) req_handler).handle(request, response);
      else {
        Object retval = req_handler.handle(request);
        if (response != null) response.send(retval, false);
      }
      return;
    }

    Object retval = handle(request);
    if (response != null) response.send(retval, false);
  }
Example #2
0
 public void sendResponse() {
   int statusCode = response.getStatus().getCode();
   if (statusCode >= 400) {
     context.clientError(statusCode);
   } else {
     response.send(MediaType.TEXT_HTML, responseContent);
   }
 }