Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -115,13 +115,11 @@ public class ServletServerHttpAsyncRequestControl implements ServerHttpAsyncRequ
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void onComplete(AsyncEvent event) throws IOException {
|
||||
this.asyncContext = null;
|
||||
this.asyncCompleted.set(true);
|
||||
public void onStartAsync(AsyncEvent event) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAsync(AsyncEvent event) throws IOException {
|
||||
public void onTimeout(AsyncEvent event) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,7 +127,9 @@ public class ServletServerHttpAsyncRequestControl implements ServerHttpAsyncRequ
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeout(AsyncEvent event) throws IOException {
|
||||
public void onComplete(AsyncEvent event) throws IOException {
|
||||
this.asyncContext = null;
|
||||
this.asyncCompleted.set(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -276,6 +276,11 @@ public class ServletHttpHandlerAdapter implements Servlet {
|
||||
this.logPrefix = logPrefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAsync(AsyncEvent event) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeout(AsyncEvent event) {
|
||||
// Should never happen since we call asyncContext.setTimeout(-1)
|
||||
@@ -342,11 +347,6 @@ public class ServletHttpHandlerAdapter implements Servlet {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAsync(AsyncEvent event) {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -128,7 +128,7 @@ public class StandardServletAsyncWebRequest extends ServletWebRequest implements
|
||||
|
||||
@Override
|
||||
public void dispatch() {
|
||||
Assert.notNull(this.asyncContext, "Cannot dispatch without an AsyncContext");
|
||||
Assert.state(this.asyncContext != null, "Cannot dispatch without an AsyncContext");
|
||||
this.asyncContext.dispatch();
|
||||
}
|
||||
|
||||
@@ -142,13 +142,13 @@ public class StandardServletAsyncWebRequest extends ServletWebRequest implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(AsyncEvent event) throws IOException {
|
||||
this.exceptionHandlers.forEach(consumer -> consumer.accept(event.getThrowable()));
|
||||
public void onTimeout(AsyncEvent event) throws IOException {
|
||||
this.timeoutHandlers.forEach(Runnable::run);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeout(AsyncEvent event) throws IOException {
|
||||
this.timeoutHandlers.forEach(Runnable::run);
|
||||
public void onError(AsyncEvent event) throws IOException {
|
||||
this.exceptionHandlers.forEach(consumer -> consumer.accept(event.getThrowable()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -32,14 +32,15 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class SimpleClientHttpRequestFactoryTests {
|
||||
|
||||
|
||||
@Test // SPR-13225
|
||||
@Test // SPR-13225
|
||||
public void headerWithNullValue() {
|
||||
HttpURLConnection urlConnection = mock(HttpURLConnection.class);
|
||||
given(urlConnection.getRequestMethod()).willReturn("GET");
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("foo", null);
|
||||
SimpleBufferingClientHttpRequest.addHeaders(urlConnection, headers);
|
||||
|
||||
verify(urlConnection, times(1)).addRequestProperty("foo", "");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -51,7 +51,6 @@ import org.springframework.core.io.buffer.DefaultDataBufferFactory;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ReactiveHttpOutputMessage;
|
||||
import org.springframework.lang.NonNull;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
@@ -173,7 +172,6 @@ public class ClientHttpConnectorTests {
|
||||
.verify();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private Buffer randomBody(int size) {
|
||||
Buffer responseBody = new Buffer();
|
||||
Random rnd = new Random();
|
||||
|
||||
Reference in New Issue
Block a user