本文整理汇总了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
}
示例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());
}
示例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;
}
示例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())));
}
示例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");
}