gpt4 book ai didi

org.springframework.web.server.WebHandler.handle()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 14:47:05 26 4
gpt4 key购买 nike

本文整理了Java中org.springframework.web.server.WebHandler.handle()方法的一些代码示例,展示了WebHandler.handle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebHandler.handle()方法的具体详情如下:
包路径:org.springframework.web.server.WebHandler
类名称:WebHandler
方法名:handle

WebHandler.handle介绍

[英]Handle the web server exchange.
[中]处理web服务器交换。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public Mono<Void> handle(ServerWebExchange exchange) {
  return this.delegate.handle(exchange);
}

代码示例来源:origin: org.springframework/spring-web

@Override
public Mono<Void> handle(ServerWebExchange exchange) {
  return this.delegate.handle(exchange);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public Mono<HandlerResult> handle(ServerWebExchange exchange, Object handler) {
  WebHandler webHandler = (WebHandler) handler;
  Mono<Void> mono = webHandler.handle(exchange);
  return mono.then(Mono.empty());
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public Mono<Void> filter(ServerWebExchange exchange) {
  return Mono.defer(() ->
      this.currentFilter != null && this.next != null ?
          this.currentFilter.filter(exchange, this.next) :
          this.handler.handle(exchange));
}

代码示例来源:origin: org.springframework/spring-web

@Override
public Mono<Void> filter(ServerWebExchange exchange) {
  return Mono.defer(() ->
      this.currentFilter != null && this.next != null ?
          this.currentFilter.filter(exchange, this.next) :
          this.handler.handle(exchange));
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void webExceptionHandler() {
  ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/unknown-argument-type"));
  List<WebExceptionHandler> handlers = Collections.singletonList(new ServerError500ExceptionHandler());
  WebHandler webHandler = new ExceptionHandlingWebHandler(this.dispatcherHandler, handlers);
  webHandler.handle(exchange).block(Duration.ofSeconds(5));
  assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, exchange.getResponse().getStatusCode());
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void thrownExceptionBecomesErrorSignal() throws Exception {
  createWebHandler(new BadRequestExceptionHandler()).handle(this.exchange).block();
  assertEquals(HttpStatus.BAD_REQUEST, this.exchange.getResponse().getStatusCode());
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void handleErrorSignal() throws Exception {
  createWebHandler(new BadRequestExceptionHandler()).handle(this.exchange).block();
  assertEquals(HttpStatus.BAD_REQUEST, this.exchange.getResponse().getStatusCode());
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void handleErrorSignalWithMultipleHttpErrorHandlers() throws Exception {
  createWebHandler(
      new UnresolvedExceptionHandler(),
      new UnresolvedExceptionHandler(),
      new BadRequestExceptionHandler(),
      new UnresolvedExceptionHandler()).handle(this.exchange).block();
  assertEquals(HttpStatus.BAD_REQUEST, this.exchange.getResponse().getStatusCode());
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
  if (this.forwardedHeaderTransformer != null) {
    request = this.forwardedHeaderTransformer.apply(request);
  }
  ServerWebExchange exchange = createExchange(request, response);
  LogFormatUtils.traceDebug(logger, traceOn ->
      exchange.getLogPrefix() + formatRequest(exchange.getRequest()) +
          (traceOn ? ", headers=" + formatHeaders(exchange.getRequest().getHeaders()) : ""));
  return getDelegate().handle(exchange)
      .doOnSuccess(aVoid -> logResponse(exchange))
      .onErrorResume(ex -> handleUnresolvedError(exchange, ex))
      .then(Mono.defer(response::setComplete));
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void unresolvedException() throws Exception {
  Mono<Void> mono = createWebHandler(new UnresolvedExceptionHandler()).handle(this.exchange);
  StepVerifier.create(mono).expectErrorMessage("boo").verify();
  assertNull(this.exchange.getResponse().getStatusCode());
}

代码示例来源:origin: org.springframework/spring-web

@Override
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
  if (this.forwardedHeaderTransformer != null) {
    request = this.forwardedHeaderTransformer.apply(request);
  }
  ServerWebExchange exchange = createExchange(request, response);
  LogFormatUtils.traceDebug(logger, traceOn ->
      exchange.getLogPrefix() + formatRequest(exchange.getRequest()) +
          (traceOn ? ", headers=" + formatHeaders(exchange.getRequest().getHeaders()) : ""));
  return getDelegate().handle(exchange)
      .doOnSuccess(aVoid -> logResponse(exchange))
      .onErrorResume(ex -> handleUnresolvedError(exchange, ex))
      .then(Mono.defer(response::setComplete));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
public Mono<Void> handle(ServerWebExchange exchange) {
  return this.delegate.handle(exchange);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Mono<Void> handle(ServerWebExchange exchange) {
  return this.delegate.handle(exchange);
}

代码示例来源:origin: org.springframework/spring-web-reactive

@Override
public Mono<HandlerResult> handle(ServerWebExchange exchange, Object handler) {
  WebHandler webHandler = (WebHandler) handler;
  Mono<Void> mono = webHandler.handle(exchange);
  return mono.then(aVoid -> Mono.empty());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
public Mono<Void> filter(ServerWebExchange exchange) {
  return Mono.defer(() ->
      this.currentFilter != null && this.next != null ?
          this.currentFilter.filter(exchange, this.next) :
          this.handler.handle(exchange));
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Mono<Void> filter(ServerWebExchange exchange) {
  return Mono.defer(() -> {
    if (this.index < this.filters.size()) {
      WebFilter filter = this.filters.get(this.index);
      WebFilterChain chain = new DefaultWebFilterChain(this, this.index + 1);
      return filter.filter(exchange, chain);
    }
    else {
      return this.handler.handle(exchange);
    }
  });
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
  ServerWebExchange exchange = createExchange(request, response);
  return getDelegate().handle(exchange)
      .onErrorResume(ex -> handleFailure(request, response, ex))
      .then(Mono.defer(response::setComplete));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
  if (this.forwardedHeaderTransformer != null) {
    request = this.forwardedHeaderTransformer.apply(request);
  }
  ServerWebExchange exchange = createExchange(request, response);
  LogFormatUtils.traceDebug(logger, traceOn ->
      exchange.getLogPrefix() + formatRequest(exchange.getRequest()) +
          (traceOn ? ", headers=" + formatHeaders(exchange.getRequest().getHeaders()) : ""));
  return getDelegate().handle(exchange)
      .doOnSuccess(aVoid -> logResponse(exchange))
      .onErrorResume(ex -> handleUnresolvedError(exchange, ex))
      .then(Mono.defer(response::setComplete));
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com