java-tutorials/aws/src/main/java/com/baeldung/LambdaRequestStreamHandler.java

19 lines
603 B
Java
Raw Normal View History

2016-12-29 23:16:46 +05:30
package com.baeldung;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
2017-01-03 21:24:12 +01:00
import org.apache.commons.io.IOUtils;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestStreamHandler;
2016-12-29 23:16:46 +05:30
public class LambdaRequestStreamHandler implements RequestStreamHandler {
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
String input = IOUtils.toString(inputStream, "UTF-8");
outputStream.write(("Hello World - " + input).getBytes());
}
}