Class SkillController
java.lang.Object
io.micronaut.aws.alexa.httpserver.controllers.SkillController
@Requires(beans=com.fasterxml.jackson.databind.ObjectMapper.class) @Requires(property="alexa.endpoint.enabled",notEquals="false")
@Controller("${alexa.endpoint.path:/alexa}")
public class SkillController
extends Object
NOTICE: This class is inspired in com.amazon.ask.servlet.SkillServlet forked from https://github.com/alexa/alexa-skills-kit-sdk-for-java ask-sdk-servlet-support module
This class takes care of the JSON serialization / deserialization of the HTTP body and the
invocation of the right method of the provided Skill
. It also handles sending back
modified session attributes, user attributes and authentication tokens when needed and handles
exception cases.
- Since:
- 2.0.0.
- Author:
- sdelamo
-
Constructor Summary
ConstructorDescriptionSkillController
(com.fasterxml.jackson.databind.ObjectMapper objectMapper, RequestEnvelopeVerificationService requestEnvelopeVerificationService, RequestEnvelopeService requestEnvelopeService) Constructor to build an instance of SkillServlet. -
Method Summary
-
Constructor Details
-
SkillController
public SkillController(com.fasterxml.jackson.databind.ObjectMapper objectMapper, RequestEnvelopeVerificationService requestEnvelopeVerificationService, RequestEnvelopeService requestEnvelopeService) Constructor to build an instance of SkillServlet.- Parameters:
objectMapper
- Jackson Object MapperrequestEnvelopeVerificationService
- Request Envelope verification servicerequestEnvelopeService
- Request Envelope Service
-
-
Method Details
-
doPost
@Post public io.micronaut.http.HttpResponse doPost(io.micronaut.http.HttpHeaders httpHeaders, @Body String body) Handles a POST request. Based on the request parameters, invokes the right method on theSkill
.- Parameters:
httpHeaders
- HTTP Headersbody
- HTTP Request Body byte array- Returns:
- response object that contains the response the servlet sends to the client
-