当前位置: 首页>>代码示例>>Java>>正文


Java ClientAbortException类代码示例

本文整理汇总了Java中org.apache.catalina.connector.ClientAbortException的典型用法代码示例。如果您正苦于以下问题:Java ClientAbortException类的具体用法?Java ClientAbortException怎么用?Java ClientAbortException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClientAbortException类属于org.apache.catalina.connector包,在下文中一共展示了ClientAbortException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clientAbortException

import org.apache.catalina.connector.ClientAbortException; //导入依赖的package包/类
@ExceptionHandler(ClientAbortException.class)
public void clientAbortException(ClientAbortException e) {
    // Nothing to respond here as client has terminated connection
}
 
开发者ID:HSLdevcom,项目名称:parkandrideAPI,代码行数:5,代码来源:ExceptionHandlers.java

示例2: testBindObservable_exceptions

import org.apache.catalina.connector.ClientAbortException; //导入依赖的package包/类
@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());
}
 
开发者ID:bbcom,项目名称:argos-dashboard,代码行数:31,代码来源:SseEmitterUtilTest.java

示例3: connectionAbort

import org.apache.catalina.connector.ClientAbortException; //导入依赖的package包/类
@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;
}
 
开发者ID:hpe-idol,项目名称:find,代码行数:8,代码来源:GlobalExceptionHandler.java

示例4: RuntimeException

import org.apache.catalina.connector.ClientAbortException; //导入依赖的package包/类
@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())));
}
 
开发者ID:esutoniagodesu,项目名称:egd-web,代码行数:6,代码来源:CustomControllerAdvice.java

示例5: service

import org.apache.catalina.connector.ClientAbortException; //导入依赖的package包/类
@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");
}
 
开发者ID:wolfgangimig,项目名称:byps,代码行数:64,代码来源:HHttpServlet.java


注:本文中的org.apache.catalina.connector.ClientAbortException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。