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 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 Mapper
      requestEnvelopeVerificationService - Request Envelope verification service
      requestEnvelopeService - 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 the Skill.
      Parameters:
      httpHeaders - HTTP Headers
      body - HTTP Request Body byte array
      Returns:
      response object that contains the response the servlet sends to the client