コード例 #1
0
ファイル: HttpRpcServer.java プロジェクト: cameronbraid/rox
 /**
  * Converts an exception raised while processing an HTTP request into a suitable HTTP response.
  *
  * <p>The response is marshalled and queued for writing on the socket associated with the original
  * request.
  *
  * @param msg The HTTP request being processed when the exception occurred.
  * @param e The exception that was raised.
  * @throws IOException if an error occurs marshalling or writing the response.
  */
 protected void handleMessageException(HttpMessageBuffer msg, Exception e) throws IOException {
   HttpResponse httpRsp;
   if (e instanceof HttpResponseException) {
     if (log.logWarn()) {
       log.warn("HttpResponseException", e);
     }
     httpRsp = this.newHttpResponse(msg, (HttpResponseException) e);
     this.queueWrite(msg.getSocket(), httpRsp.marshal(), true);
   } else if (e instanceof RemoteSocketClosedException) {
     if (log.logTrace()) {
       log.trace("Remote entity closed connection", e);
     }
   } else {
     if (log.logError()) {
       log.error("Internal Server Error", e);
     }
     httpRsp =
         this.newHttpResponse(
             msg,
             new HttpResponseException(
                 HttpConstants.StatusCodes._500_INTERNAL_SERVER_ERROR,
                 "Internal Server Error",
                 e));
     this.queueWrite(msg.getSocket(), httpRsp.marshal(), true);
   }
 }
コード例 #2
0
ファイル: HttpRpcServer.java プロジェクト: cameronbraid/rox
 protected void handleProcessingException(Socket socket, Exception e) {
   log.error("Exception on selecting thread (socket=" + Utils.toString(socket) + ")", e);
 }