【发布时间】:2021-06-12 16:32:31
【问题描述】:
我有一个与 API Gateway 代理集成的 Lambda 函数,这意味着它接受代理+资源作为输入。
我有一个 java Lambda 类,它接受 APIGatewayProxyRequestEvent 类型作为输入并将 APIGatewayProxyRequestOutput 作为响应/输出。
public class DashboardOrchestratorHandler implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
@Override
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent event, Context context) {
APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent();
response.setIsBase64Encoded(false);
response.setStatusCode(200);
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "text/html");
response.setHeaders(headers);
response.setBody("<!DOCTYPE html><html><head><title>AWS Lambda sample</title></head><body>" +
"<h1>Welcome</h1><p>Page generated by a Lambda function.</p>" +
"</body></html>");
// log execution details
//Util.logEnvironment(event, context, gson);
return response;
}
}
现在我正在寻找一些关于如何根据请求路径和请求参数编排不同类的指南。
【问题讨论】:
标签: java aws-lambda aws-api-gateway amazon-api-gateway