Skip to content

Commit

Permalink
Merge pull request #124 from newrelic/kwest/example-fix
Browse files Browse the repository at this point in the history
Fix of example
  • Loading branch information
Katie West authored Apr 29, 2021
2 parents 63a3cc9 + e9f740e commit 4f0d655
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions examples/java/src/main/java/com/serverless/Handler.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.serverless;

import java.util.Collections;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
Expand All @@ -9,18 +8,13 @@
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;

public class Handler implements RequestHandler<Map<String, Object>, ApiGatewayResponse> {
public class Handler implements RequestHandler<Map<String, Object>, String> {

private static final Logger LOG = LogManager.getLogger(Handler.class);

@Override
public ApiGatewayResponse handleRequest(Map<String, Object> input, Context context) {
public String handleRequest(Map<String, Object> input, Context context) {
LOG.info("received: {}", input);
Response responseBody = new Response("Go Serverless v1.x! Your function executed successfully!", input);
return ApiGatewayResponse.builder()
.setStatusCode(200)
.setObjectBody(responseBody)
.setHeaders(Collections.singletonMap("X-Powered-By", "AWS Lambda & serverless"))
.build();
return "ok";
}
}

0 comments on commit 4f0d655

Please sign in to comment.