Updates to version 5.0.0-SNAPSHOT
Changes for Framework 7
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>jar</packaging>
|
||||
<name>Spring Cloud Function Docs</name>
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -6,13 +6,13 @@
|
||||
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<name>Spring Cloud Function Parent</name>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>spring-cloud-function-adapter-parent</name>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -179,7 +179,7 @@ public final class CustomRuntimeEventLoop implements SmartLifecycle {
|
||||
@Override
|
||||
public int getRemainingTimeInMillis() {
|
||||
long now = System.currentTimeMillis();
|
||||
if (!headers.containsKey("Lambda-Runtime-Deadline-Ms")) {
|
||||
if (!headers.containsHeader("Lambda-Runtime-Deadline-Ms")) {
|
||||
return 0;
|
||||
}
|
||||
int delta = (int) (Long.parseLong(headers.getFirst("Lambda-Runtime-Deadline-Ms")) - now);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<artifactId>spring-cloud-function-adapter-parent</artifactId>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud.function.aws-lambda.packaging</groupId>
|
||||
<artifactId>spring-cloud-function-aws-gradle-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud.function.aws-lambda.packaging</groupId>
|
||||
<artifactId>spring-cloud-function-aws-gradle-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-function-grpc-cloudevent-ext</artifactId>
|
||||
<name>spring-cloud-function-grpc-cloudevent-ext</name>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<grpc.version>1.55.1</grpc.version>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -279,7 +279,7 @@ public class ServerlessHttpServletRequest implements HttpServletRequest {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getContentType() {
|
||||
return this.headers.containsKey(HttpHeaders.CONTENT_TYPE) ? this.headers.get(HttpHeaders.CONTENT_TYPE).get(0) : null;
|
||||
return this.headers.containsHeader(HttpHeaders.CONTENT_TYPE) ? this.headers.get(HttpHeaders.CONTENT_TYPE).get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -713,17 +713,17 @@ public class ServerlessHttpServletRequest implements HttpServletRequest {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getHeader(String name) {
|
||||
return this.headers.containsKey(name) ? this.headers.get(name).get(0) : null;
|
||||
return this.headers.containsHeader(name) ? this.headers.get(name).get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getHeaders(String name) {
|
||||
return Collections.enumeration(this.headers.containsKey(name) ? this.headers.get(name) : new LinkedList<>());
|
||||
return Collections.enumeration(this.headers.containsHeader(name) ? this.headers.get(name) : new LinkedList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getHeaderNames() {
|
||||
return Collections.enumeration(this.headers.keySet());
|
||||
return Collections.enumeration(this.headers.headerNames());
|
||||
}
|
||||
|
||||
public void setHeader(String name, @Nullable String value) {
|
||||
@@ -735,7 +735,7 @@ public class ServerlessHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
|
||||
public void addHeaders(MultiValueMap<String, String> headers) {
|
||||
this.headers.addAll(headers);
|
||||
this.headers.addAll(new HttpHeaders(headers));
|
||||
}
|
||||
|
||||
public void setHeaders(MultiValueMap<String, String> headers) {
|
||||
|
||||
@@ -217,7 +217,7 @@ public class ServerlessHttpServletResponse implements HttpServletResponse {
|
||||
|
||||
@Override
|
||||
public boolean containsHeader(String name) {
|
||||
return this.headers.containsKey(name);
|
||||
return this.headers.containsHeader(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,7 +231,7 @@ public class ServerlessHttpServletResponse implements HttpServletResponse {
|
||||
*/
|
||||
@Override
|
||||
public Collection<String> getHeaderNames() {
|
||||
return this.headers.keySet();
|
||||
return this.headers.headerNames();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +249,7 @@ public class ServerlessHttpServletResponse implements HttpServletResponse {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getHeader(String name) {
|
||||
return this.headers.containsKey(name) ? this.headers.get(name).get(0) : null;
|
||||
return this.headers.containsHeader(name) ? this.headers.get(name).get(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +265,7 @@ public class ServerlessHttpServletResponse implements HttpServletResponse {
|
||||
*/
|
||||
@Override
|
||||
public List<String> getHeaders(String name) {
|
||||
if (!this.headers.containsKey(name)) {
|
||||
if (!this.headers.containsHeader(name)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return this.headers.get(name);
|
||||
@@ -281,7 +281,7 @@ public class ServerlessHttpServletResponse implements HttpServletResponse {
|
||||
*/
|
||||
@Nullable
|
||||
public Object getHeaderValue(String name) {
|
||||
return this.headers.containsKey(name) ? this.headers.get(name).get(0) : null;
|
||||
return this.headers.containsHeader(name) ? this.headers.get(name).get(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,6 +329,15 @@ public class ServerlessHttpServletResponse implements HttpServletResponse {
|
||||
setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRedirect(String location, int statusCode, boolean clearBuffer) throws IOException {
|
||||
Assert.state(!isCommitted(), "Cannot send redirect - response is already committed");
|
||||
Assert.notNull(location, "Redirect URL must not be null");
|
||||
setHeader(HttpHeaders.LOCATION, location);
|
||||
setStatus(statusCode);
|
||||
//TODO: deal with clearBuffer
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getRedirectedUrl() {
|
||||
return getHeader(HttpHeaders.LOCATION);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-function-dependencies</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Spring Cloud Function Dependencies</name>
|
||||
<description>Spring Cloud Function Dependencies</description>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -34,7 +34,7 @@ open class KotlinLambdasConfiguration {
|
||||
open fun uppercase(): Function<String, String> = KotlinComponentFunction()
|
||||
@Bean
|
||||
open fun kotlinFunction(): (String) -> String {
|
||||
return { it.toUpperCase() }
|
||||
return { it.uppercase() }
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -36,7 +36,7 @@ open class KotlinSuspendFlowLambdasConfiguration {
|
||||
|
||||
@Bean
|
||||
open fun kotlinFunction(): suspend (Flow<String>) -> Flow<String> = { flow ->
|
||||
flow.map { value -> value.toUpperCase() }
|
||||
flow.map { value -> value.uppercase() }
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -56,7 +56,7 @@ open class HeadersToMessageSuspendTests {
|
||||
)
|
||||
|
||||
Assertions.assertThat(postForEntity.body).isEqualTo("[{\"name\":\"Bob\",\"age\":25}]")
|
||||
Assertions.assertThat(postForEntity.headers.containsKey("x-content-type")).isTrue
|
||||
Assertions.assertThat(postForEntity.headers.headerNames()).contains("x-content-type")
|
||||
Assertions.assertThat(postForEntity.headers["x-content-type"]!![0])
|
||||
.isEqualTo("application/xml")
|
||||
Assertions.assertThat(postForEntity.headers["foo"]!![0]).isEqualTo("bar")
|
||||
@@ -67,7 +67,7 @@ open class HeadersToMessageSuspendTests {
|
||||
"HELLO", String::class.java
|
||||
)
|
||||
Assertions.assertThat(postForEntity.body).isEqualTo("[\"HELLO\"]")
|
||||
Assertions.assertThat(postForEntity.headers.containsKey("x-content-type")).isTrue
|
||||
Assertions.assertThat(postForEntity.headers.headerNames()).contains("x-content-type")
|
||||
Assertions.assertThat(postForEntity.headers["x-content-type"]!![0])
|
||||
.isEqualTo("application/xml")
|
||||
Assertions.assertThat(postForEntity.headers["foo"]!![0]).isEqualTo("bar")
|
||||
|
||||
@@ -55,7 +55,7 @@ open class HeadersToMessageTests {
|
||||
.body("{\"name\":\"Bob\",\"age\":25}"), String::class.java
|
||||
)
|
||||
Assertions.assertThat(postForEntity.body).isEqualTo("{\"name\":\"Bob\",\"age\":25}")
|
||||
Assertions.assertThat(postForEntity.headers.containsKey("x-content-type")).isTrue
|
||||
Assertions.assertThat(postForEntity.headers.headerNames()).contains("x-content-type")
|
||||
Assertions.assertThat(postForEntity.headers["x-content-type"]!![0])
|
||||
.isEqualTo("application/xml")
|
||||
Assertions.assertThat(postForEntity.headers["foo"]!![0]).isEqualTo("bar")
|
||||
@@ -66,7 +66,7 @@ open class HeadersToMessageTests {
|
||||
"{\"name\":\"Bob\",\"age\":25}", String::class.java
|
||||
)
|
||||
Assertions.assertThat(postForEntity.body).isEqualTo("{\"name\":\"Bob\",\"age\":25}")
|
||||
Assertions.assertThat(postForEntity.headers.containsKey("x-content-type")).isTrue
|
||||
Assertions.assertThat(postForEntity.headers.headerNames().contains("x-content-type"))
|
||||
Assertions.assertThat(postForEntity.headers["x-content-type"]!![0])
|
||||
.isEqualTo("application/xml")
|
||||
Assertions.assertThat(postForEntity.headers["foo"]!![0]).isEqualTo("bar")
|
||||
@@ -76,9 +76,9 @@ open class HeadersToMessageTests {
|
||||
@org.springframework.boot.test.context.TestConfiguration
|
||||
open class TestConfiguration {
|
||||
@Bean("string")
|
||||
open fun functiono(): (message: Message<String?>) -> Message<String?> = { request: Message<String?> ->
|
||||
val message =
|
||||
MessageBuilder.withPayload(request.payload)
|
||||
open fun functiono(): (message: Message<String>) -> Message<String> = { request: Message<String> ->
|
||||
val message: Message<String> =
|
||||
MessageBuilder.withPayload(request.payload as String)
|
||||
.setHeader("X-Content-Type", "application/xml")
|
||||
.setHeader("foo", "bar").build()
|
||||
message
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
<aws-lambda-events.version>3.14.0</aws-lambda-events.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<properties>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<properties>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
<aws-lambda-events.version>3.14.0</aws-lambda-events.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
<aws-lambda-events.version>3.14.0</aws-lambda-events.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
<aws-lambda-events.version>3.14.0</aws-lambda-events.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<name>function-sample-grpc-cloudevent</name>
|
||||
<description>Demo project for Spring Boot</description>
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<grpc.version>1.55.1</grpc.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<reactor.version>3.1.2.RELEASE</reactor.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<spring-cloud-function.version>4.3.1-SNAPSHOT</spring-cloud-function.version>
|
||||
<spring-cloud-function.version>5.0.0-SNAPSHOT</spring-cloud-function.version>
|
||||
<wrapper.version>1.0.31.RELEASE</wrapper.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -81,7 +81,7 @@ public class FunctionController {
|
||||
.getRequest()).getMultiFileMap();
|
||||
if (!CollectionUtils.isEmpty(multiFileMap)) {
|
||||
List<Message<MultipartFile>> files = multiFileMap.values().stream().flatMap(v -> v.stream())
|
||||
.map(file -> MessageBuilder.withPayload(file).copyHeaders(wrapper.getHeaders()).build())
|
||||
.map(file -> MessageBuilder.withPayload(file).copyHeaders(wrapper.getHeaders().asMultiValueMap()).build())
|
||||
.collect(Collectors.toList());
|
||||
FunctionInvocationWrapper function = wrapper.getFunction();
|
||||
|
||||
@@ -199,7 +199,7 @@ public class FunctionController {
|
||||
wrapper.getHeaders().addAll(key, Arrays.asList(request.getHeaderValues(key)));
|
||||
}
|
||||
|
||||
HttpHeaders headers = HttpHeaders.writableHttpHeaders(wrapper.getHeaders());
|
||||
HttpHeaders headers = HttpHeaders.copyOf(wrapper.getHeaders());
|
||||
headers.set("uri", ((ServletWebRequest) request).getRequest().getRequestURI());
|
||||
|
||||
String argument = (String) request.getAttribute(WebRequestConstants.ARGUMENT,
|
||||
|
||||
@@ -65,8 +65,8 @@ public class HttpSupplier implements Supplier<Flux<?>> {
|
||||
}
|
||||
|
||||
private Flux<?> get(WebClient client) {
|
||||
Flux<?> result = client.get().uri(this.props.getSource().getUrl()).exchange()
|
||||
.flatMap(this::transform).repeat();
|
||||
Flux<?> result = client.get().uri(this.props.getSource().getUrl()).exchangeToMono(this::transform)
|
||||
.repeat();
|
||||
if (this.props.isDebug()) {
|
||||
result = result.log();
|
||||
}
|
||||
|
||||
@@ -192,11 +192,11 @@ public class SupplierExporter implements SmartLifecycle {
|
||||
}
|
||||
Mono<ClientResponse> result = this.client.post().uri(uri)
|
||||
.headers(headers -> headers(headers, destination, value)).bodyValue(body)
|
||||
.exchange()
|
||||
.doOnNext(response -> {
|
||||
.exchangeToMono(response -> {
|
||||
if (this.debug) {
|
||||
logger.debug("Response STATUS: " + response.statusCode());
|
||||
}
|
||||
return Mono.just(response);
|
||||
});
|
||||
if (this.debug) {
|
||||
result = result.log();
|
||||
|
||||
@@ -62,7 +62,7 @@ public final class HeaderUtils {
|
||||
for (String name : headers.keySet()) {
|
||||
Object value = headers.get(name);
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
if (!IGNORED.containsKey(name) && !ignoredHeders.contains(name)) {
|
||||
if (!IGNORED.containsHeader(name) && !ignoredHeders.contains(name)) {
|
||||
Collection<?> values = multi(value);
|
||||
for (Object object : values) {
|
||||
result.set(name, object.toString());
|
||||
@@ -80,10 +80,10 @@ public final class HeaderUtils {
|
||||
|
||||
public static HttpHeaders sanitize(HttpHeaders request, List<String> ignoredHeders, List<String> requestOnlyHeaders) {
|
||||
HttpHeaders result = new HttpHeaders();
|
||||
for (String name : request.keySet()) {
|
||||
for (String name : request.headerNames()) {
|
||||
List<String> value = request.get(name);
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
if (!IGNORED.containsKey(name) && !REQUEST_ONLY.containsKey(name) && !ignoredHeders.contains(name) && !requestOnlyHeaders.contains(name)) {
|
||||
if (!IGNORED.containsHeader(name) && !REQUEST_ONLY.containsHeader(name) && !ignoredHeders.contains(name) && !requestOnlyHeaders.contains(name)) {
|
||||
result.put(name, value);
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public final class HeaderUtils {
|
||||
|
||||
public static MessageHeaders fromHttp(HttpHeaders headers) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
for (String name : headers.keySet()) {
|
||||
for (String name : headers.headerNames()) {
|
||||
Collection<?> values = multi(headers.get(name));
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
Object value = values == null ? null
|
||||
|
||||
@@ -60,7 +60,7 @@ public class HeadersToMessageTests {
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.body("{\"name\":\"Bob\",\"age\":25}"), String.class);
|
||||
assertThat(postForEntity.getBody()).isEqualTo("{\"name\":\"Bob\",\"age\":25}");
|
||||
assertThat(postForEntity.getHeaders().containsKey("x-content-type")).isTrue();
|
||||
assertThat(postForEntity.getHeaders().containsHeader("x-content-type")).isTrue();
|
||||
assertThat(postForEntity.getHeaders().get("x-content-type").get(0))
|
||||
.isEqualTo("application/xml");
|
||||
assertThat(postForEntity.getHeaders().get("foo").get(0)).isEqualTo("bar");
|
||||
@@ -69,7 +69,7 @@ public class HeadersToMessageTests {
|
||||
postForEntity = this.rest.postForEntity(new URI("/functions/string"),
|
||||
"{\"name\":\"Bob\",\"age\":25}", String.class);
|
||||
assertThat(postForEntity.getBody()).isEqualTo("{\"name\":\"Bob\",\"age\":25}");
|
||||
assertThat(postForEntity.getHeaders().containsKey("x-content-type")).isTrue();
|
||||
assertThat(postForEntity.getHeaders().containsHeader("x-content-type")).isTrue();
|
||||
assertThat(postForEntity.getHeaders().get("x-content-type").get(0))
|
||||
.isEqualTo("application/xml");
|
||||
assertThat(postForEntity.getHeaders().get("foo").get(0)).isEqualTo("bar");
|
||||
|
||||
@@ -170,7 +170,7 @@ public class HttpPostIntegrationTests {
|
||||
.post(new URI("/messages")).contentType(MediaType.APPLICATION_JSON)
|
||||
.header("x-foo", "bar").body("[\"foo\",\"bar\"]"), String.class);
|
||||
assertThat(result.getHeaders().getFirst("x-foo")).isEqualTo("bar");
|
||||
assertThat(result.getHeaders()).doesNotContainKey("id");
|
||||
assertThat(result.getHeaders().headerNames()).doesNotContain("id");
|
||||
assertThat(result.getBody()).isEqualTo("[\"(FOO)\",\"(BAR)\"]");
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class FunctionEndpointInitializerTests {
|
||||
headers.set("Accept", "application/json");
|
||||
HttpEntity entity = new HttpEntity(headers);
|
||||
|
||||
String urlTemplate = UriComponentsBuilder.fromHttpUrl("http://localhost:" + port + "/nullPayload")
|
||||
String urlTemplate = UriComponentsBuilder.fromUriString("http://localhost:" + port + "/nullPayload")
|
||||
.queryParam("fname", "Jim").queryParam("lname", "Lahey").encode().toUriString();
|
||||
|
||||
ResponseEntity<String> response = testRestTemplate.exchange(urlTemplate, HttpMethod.GET, entity, String.class);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class HeadersToMessageTests {
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.body("{\"name\":\"Bob\",\"age\":25}"), String.class);
|
||||
assertThat(postForEntity.getBody()).isEqualTo("{\"name\":\"Bob\",\"age\":25}");
|
||||
assertThat(postForEntity.getHeaders().containsKey("x-content-type")).isTrue();
|
||||
assertThat(postForEntity.getHeaders().headerNames()).contains("x-content-type");
|
||||
assertThat(postForEntity.getHeaders().get("x-content-type").get(0))
|
||||
.isEqualTo("application/xml");
|
||||
assertThat(postForEntity.getHeaders().get("foo").get(0)).isEqualTo("bar");
|
||||
@@ -75,7 +75,7 @@ public class HeadersToMessageTests {
|
||||
.body("{\"name\":\"Bob\",\"age\":25}"), String.class);
|
||||
assertThat(postForEntity.getBody())
|
||||
.isEqualTo("{\"name\":\"Bob\",\"age\":25,\"foo\":\"bar\"}");
|
||||
assertThat(postForEntity.getHeaders().containsKey("x-context-type")).isTrue();
|
||||
assertThat(postForEntity.getHeaders().headerNames()).contains("x-context-type");
|
||||
assertThat(postForEntity.getHeaders().get("x-context-type").get(0))
|
||||
.isEqualTo("rubbish");
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class HttpPostIntegrationTests {
|
||||
.accept(MediaType.valueOf("application/stream+json"))
|
||||
.header("x-foo", "bar").body("[\"foo\",\"bar\"]"), String.class);
|
||||
assertThat(result.getHeaders().getFirst("x-foo")).isEqualTo("bar");
|
||||
assertThat(result.getHeaders()).doesNotContainKey("id");
|
||||
assertThat(result.getHeaders().headerNames()).doesNotContain("id");
|
||||
assertThat(result.getBody()).isEqualTo("[\"(FOO)\",\"(BAR)\"]");
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class HttpPostIntegrationTests {
|
||||
.accept(MediaType.valueOf("application/stream+json"))
|
||||
.body("[\"foo\",\"bar\"]"), String.class);
|
||||
assertThat(result.getHeaders().getFirst("foo")).isEqualTo("bar");
|
||||
assertThat(result.getHeaders()).doesNotContainKey("id");
|
||||
assertThat(result.getHeaders().headerNames()).doesNotContain("id");
|
||||
assertThat(result.getBody()).isEqualTo("[\"(FOO)\",\"(BAR)\"]");
|
||||
}
|
||||
|
||||
|
||||
@@ -72,19 +72,18 @@ public class RoutingFunctionTests {
|
||||
public void testFunctionMessage() throws Exception {
|
||||
|
||||
HttpEntity<String> postForEntity = this.rest
|
||||
.exchange(RequestEntity.post(new URI("/functions/" + RoutingFunction.FUNCTION_NAME))
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.header("spring.cloud.function.definition", "employee")
|
||||
.header("abc", "abc")
|
||||
.header("xyz", "xyz")
|
||||
.body("{\"name\":\"Bob\",\"age\":25}"), String.class);
|
||||
.exchange(RequestEntity.post(new URI("/functions/" + RoutingFunction.FUNCTION_NAME))
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.header("spring.cloud.function.definition", "employee")
|
||||
.header("abc", "abc")
|
||||
.header("xyz", "xyz")
|
||||
.body("{\"name\":\"Bob\",\"age\":25}"), String.class);
|
||||
assertThat(postForEntity.getBody()).isEqualTo("{\"name\":\"Bob\",\"age\":25}");
|
||||
assertThat(postForEntity.getHeaders().containsKey("x-content-type")).isTrue();
|
||||
assertThat(postForEntity.getHeaders().headerNames()).contains("x-content-type");
|
||||
assertThat(postForEntity.getHeaders().get("x-content-type").get(0))
|
||||
.isEqualTo("application/xml");
|
||||
assertThat(postForEntity.getHeaders().containsKey("spring.cloud.function.definition")).isTrue();
|
||||
assertThat(postForEntity.getHeaders().containsKey("abc")).isFalse();
|
||||
assertThat(postForEntity.getHeaders().containsKey("xyz")).isFalse();
|
||||
.isEqualTo("application/xml");
|
||||
assertThat(postForEntity.getHeaders().headerNames()).contains("spring.cloud.function.definition")
|
||||
.doesNotContain("abc", "xyz");
|
||||
assertThat(postForEntity.getHeaders().get("foo").get(0)).isEqualTo("bar");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-starter-function-web</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-parent</artifactId>
|
||||
<version>4.3.1-SNAPSHOT</version>
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-starter-function-webflux</artifactId>
|
||||
<name>spring-cloud-starter-function-webflux</name>
|
||||
|
||||
Reference in New Issue
Block a user