Java 类org.apache.catalina.connector.ClientAbortException 实例源码

项目:argos-dashboard    文件:SseEmitterUtilTest.java   
@Test
public void testBindObservable_exceptions() throws IOException {
    Observable<Integer> obs = Observable.range(1, 100);
    doThrow(ClientAbortException.class).when(emitter).send(anyInt());
    SseEmitterUtil.bindObservable(emitter, obs);
    verify(emitter, times(100)).send(anyInt());

    reset(emitter);

    obs = Observable.range(1, 100);
    doThrow(new IllegalStateException("ResponseBodyEmitter is already set complete")).when(emitter).send(anyInt());
    SseEmitterUtil.bindObservable(emitter, obs);
    verify(emitter, times(100)).send(anyInt());

    reset(emitter);

    obs = Observable.range(1, 100);
    doThrow(new IllegalStateException("Unit Test")).when(emitter).send(anyInt());
    SseEmitterUtil.bindObservable(emitter, obs);
    verify(emitter, times(1)).send(anyInt());
    verify(emitter).completeWithError(any());

    reset(emitter);

    obs = Observable.range(1, 100);
    doThrow(new RuntimeException("Unit Test")).when(emitter).send(anyInt());
    SseEmitterUtil.bindObservable(emitter, obs);
    verify(emitter, times(1)).send(anyInt());
    verify(emitter).completeWithError(any());
}
项目:find    文件:GlobalExceptionHandler.java   
@ExceptionHandler(ClientAbortException.class)
@ResponseBody
public ErrorResponse connectionAbort(final ClientAbortException e) {
    // Tomcat-specific exception when existing request is aborted by client
    log.debug("Client aborted connection", e);
    return null;
}
项目:egd-web    文件:CustomControllerAdvice.java   
@ExceptionHandler({ClientAbortException.class})
public ResponseEntity<GenericMessage<String>> connection_reset_by_peer(Exception e) {
    log.error("connection_reset_by_peer {}", e.getMessage());
    return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(messageOf(new RuntimeException(e.getMessage())));
}
项目:parkandrideAPI    文件:ExceptionHandlers.java   
@ExceptionHandler(ClientAbortException.class)
public void clientAbortException(ClientAbortException e) {
    // Nothing to respond here as client has terminated connection
}
项目:byps    文件:HHttpServlet.java   
@Override
protected void service(HttpServletRequest request,
    HttpServletResponse response) throws ServletException, IOException {
  if (log.isDebugEnabled()) log.debug("service(");
  if (log.isDebugEnabled()) {
    log.debug("method=" + request.getMethod());
    log.debug("params= " + request.getParameterMap());
  }

  int status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
  Throwable ex = null;

  try {

    if (httpHeaderkeepAliveTimeout != null) {
      response.addHeader("Connection", "Keep-Alive");
      response.addHeader("Keep-Alive", "timeout=" + httpHeaderkeepAliveTimeout);
    }

    super.service(request, response);
    status = response.getStatus();

  }
  catch (Throwable e) {
    ex = e;

    if (!(e instanceof ClientAbortException)) {
      if (e instanceof FileNotFoundException) {
        status = HttpServletResponse.SC_NOT_FOUND;
      }

      if (!response.isCommitted()) {
        try {
          response.sendError(status, e.getMessage());
        }
        catch (Throwable e2) {
          log.debug("ex2=" + e2 + " caused by:", e);
        }
      }
    }

  }
  finally {

    switch (status) {
    case HttpServletResponse.SC_OK:
    case BExceptionC.RESEND_LONG_POLL:
    case BExceptionC.UNAUTHORIZED:
    case BExceptionC.SESSION_CLOSED:
      if (log.isDebugEnabled()) log.debug(makeLogRequest(request, status));
      break;
    case BExceptionC.FORBIDDEN:
    case BExceptionC.TIMEOUT:
      if (log.isInfoEnabled()) log.info(makeLogRequest(request, status));
      break;
    default:
      if (log.isInfoEnabled()) log.info(makeLogRequest(request, status), ex);
      break;
    }
  }

  if (log.isDebugEnabled()) log.debug(")service");
}