@Nullable @Override public SslInfo getSslInfo() { return getDelegate().getSslInfo(); }
public MutatedServerHttpRequest(URI uri, @Nullable String contextPath, HttpHeaders headers, String methodValue, MultiValueMap<String, HttpCookie> cookies, @Nullable SslInfo sslInfo, Flux<DataBuffer> body, ServerHttpRequest originalRequest) { super(uri, contextPath, headers); this.methodValue = methodValue; this.cookies = cookies; this.remoteAddress = originalRequest.getRemoteAddress(); this.sslInfo = sslInfo != null ? sslInfo : originalRequest.getSslInfo(); this.body = body; this.originalRequest = originalRequest; }
@Nullable @Override public SslInfo getSslInfo() { return getDelegate().getSslInfo(); }
public MutatedServerHttpRequest(URI uri, @Nullable String contextPath, HttpHeaders headers, String methodValue, MultiValueMap<String, HttpCookie> cookies, @Nullable SslInfo sslInfo, Flux<DataBuffer> body, ServerHttpRequest originalRequest) { super(uri, contextPath, headers); this.methodValue = methodValue; this.cookies = cookies; this.remoteAddress = originalRequest.getRemoteAddress(); this.sslInfo = sslInfo != null ? sslInfo : originalRequest.getSslInfo(); this.body = body; this.originalRequest = originalRequest; }
@Test public void mutateRequest() throws Exception { SslInfo sslInfo = mock(SslInfo.class); ServerHttpRequest request = createHttpRequest("/").mutate().sslInfo(sslInfo).build(); assertSame(sslInfo, request.getSslInfo()); request = createHttpRequest("/").mutate().method(HttpMethod.DELETE).build(); assertEquals(HttpMethod.DELETE, request.getMethod()); String baseUri = "http://aaa.org:8080/a"; request = createHttpRequest(baseUri).mutate().uri(URI.create("http://bbb.org:9090/b")).build(); assertEquals("http://bbb.org:9090/b", request.getURI().toString()); request = createHttpRequest(baseUri).mutate().path("/b/c/d").build(); assertEquals("http://aaa.org:8080/b/c/d", request.getURI().toString()); request = createHttpRequest(baseUri).mutate().path("/app/b/c/d").contextPath("/app").build(); assertEquals("http://aaa.org:8080/app/b/c/d", request.getURI().toString()); assertEquals("/app", request.getPath().contextPath().value()); }
public MutatedServerHttpRequest(URI uri, @Nullable String contextPath, HttpHeaders headers, String methodValue, MultiValueMap<String, HttpCookie> cookies, @Nullable SslInfo sslInfo, Flux<DataBuffer> body, ServerHttpRequest originalRequest) { super(uri, contextPath, headers); this.methodValue = methodValue; this.cookies = cookies; this.remoteAddress = originalRequest.getRemoteAddress(); this.sslInfo = sslInfo != null ? sslInfo : originalRequest.getSslInfo(); this.body = body; this.originalRequest = originalRequest; }
@Nullable @Override public SslInfo getSslInfo() { return getDelegate().getSslInfo(); }
public MutatedServerHttpRequest(URI uri, @Nullable String contextPath, HttpHeaders headers, String methodValue, MultiValueMap<String, HttpCookie> cookies, @Nullable SslInfo sslInfo, Flux<DataBuffer> body, ServerHttpRequest originalRequest) { super(uri, contextPath, headers); this.methodValue = methodValue; this.cookies = cookies; this.remoteAddress = originalRequest.getRemoteAddress(); this.sslInfo = sslInfo != null ? sslInfo : originalRequest.getSslInfo(); this.body = body; this.originalRequest = originalRequest; }
@Nullable @Override public SslInfo getSslInfo() { return getDelegate().getSslInfo(); }
@Override public Mono<Void> saveToken(ServerWebExchange exchange, CsrfToken token) { return Mono.fromRunnable(() -> { Optional<String> tokenValue = Optional.ofNullable(token).map(CsrfToken::getToken); ResponseCookie cookie = ResponseCookie.from(this.cookieName, tokenValue.orElse("")) .domain(this.cookieDomain) .httpOnly(this.cookieHttpOnly) .maxAge(tokenValue.map(val -> -1).orElse(0)) .path(Optional.ofNullable(this.cookiePath).orElseGet(() -> getRequestContext(exchange.getRequest()))) .secure(Optional.ofNullable(exchange.getRequest().getSslInfo()).map(sslInfo -> true).orElse(false)) .build(); exchange.getResponse().addCookie(cookie); }); }