【发布时间】:2023-02-21 06:29:09
【问题描述】:
是否可以访问从 aws apigateway 转发到使用 spring cloud 函数实现的 awslamdba 的查询参数。以下是我的实现。 我使用 http get 请求调用它
示例:http://sampledomain.com/test?param1=value
如何在下面的方法中检索 param1 值
@Bean
public Function<Message<String>,String> reverseString2() {
return value1 -> {
System.out.println("headers..."+value1.getHeaders());
value1.getHeaders().entrySet().forEach(entry -> System.out.println(entry.getKey() + " - " + entry.getValue()));
return "example";
} ;
}
【问题讨论】:
-
它应该在标题中。你说不是?您使用的是什么版本的 s-c-function?
-
它正在拉 3.2.x,我使用的 spring cloud 版本是 2021.0.1 下面是我的 pom artifactId> <version>2.6.4</version> <relativePath /> </parent> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies< /artifactId> <版本>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies>
-
比它应该在标题中。不是吗?
-
当我使用下面的内容时,我得到了路径参数。 @Bean public Function<APIGatewayProxyRequestEvent, String> reverseString1() { return value1 -> { System.out.println("headers..." + value1.getHeaders()); System.out.println("paylaod..." + value1.getPathParameters());返回“样本”; }; }
-
不确定我错过了什么..以下是我的 cloudwatch 日志中的标题