|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -20,7 +20,6 @@ import java.util.ArrayList;
@@ -20,7 +20,6 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
import java.util.function.Supplier; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
|
import org.reactivestreams.Publisher; |
|
|
|
|
@ -215,7 +214,6 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
@@ -215,7 +214,6 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
|
|
|
|
|
if (!this.state.compareAndSet(State.NEW, State.COMMITTING)) { |
|
|
|
|
return Mono.empty(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.commitActions.add(() -> |
|
|
|
|
Mono.fromRunnable(() -> { |
|
|
|
|
applyStatusCode(); |
|
|
|
|
@ -223,15 +221,14 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
@@ -223,15 +221,14 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
|
|
|
|
|
applyCookies(); |
|
|
|
|
this.state.set(State.COMMITTED); |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
if (writeAction != null) { |
|
|
|
|
this.commitActions.add(writeAction); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<? extends Mono<Void>> actions = this.commitActions.stream() |
|
|
|
|
.map(Supplier::get).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
return Flux.concat(actions).then(); |
|
|
|
|
Flux<Void> commit = Flux.empty(); |
|
|
|
|
for (Supplier<? extends Mono<Void>> actions : this.commitActions) { |
|
|
|
|
commit = commit.concatWith(actions.get()); |
|
|
|
|
} |
|
|
|
|
return commit.then(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|