gpt4 book ai didi

Java : How to get a Request object for your AWS Lambda event from API Gateway?

转载 作者:行者123 更新时间:2023-11-30 10:42:51 25 4
gpt4 key购买 nike

有什么方法可以获取 JAVA 中的 lambda 函数中的值吗?我可以看到在 nodejs 中有 event.params 但我无法在 Java 中找出类似的方法。

我可以在 API Gateway Content-Type 中使用它,

{
"name": "$input.params('name')"
}

但是,

我们如何在 Java 的 AWS Lambda 中获取此输入?

最佳答案

来自 the documentation对于 Java 中的 Lambda 函数处理程序(强调我的):

The general syntax for the handler is as follows:

outputType handler-name(inputType input, Context context) {
...
}

inputType – The first handler parameter is the input to the handler, which can be event data (published by an event source) or custom input that you provide such as a string or any custom data object. In order for AWS Lambda to successfully invoke this handler, the function must be invoked with input data that can be serialized into the data type of the input parameter.

这样就可以在您的输入参数中使用了。

关于Java : How to get a Request object for your AWS Lambda event from API Gateway?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37956714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com