public class SkillServlet
extends javax.servlet.http.HttpServlet
Simple implementation of a skill in the form of a Java EE servlet. Use this class when coding the skill as a web service.
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.
Constructor and Description |
---|
SkillServlet(Skill skill)
Constructor to build an instance of SkillServlet.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doPost(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles a POST request.
|
void |
handleRequest(InputStream input,
OutputStream output)
This method is the entry point when executing your servlet.
|
void |
setProxy(Proxy proxy)
Sets a
Proxy object that this servlet may use if Request Signature Verification is enabled. |
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
public SkillServlet(Skill skill)
skill
- an Alexa skill instance.protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
Skill
.doPost
in class javax.servlet.http.HttpServlet
request
- the object that contains the request the client has made of the servletresponse
- object that contains the response the servlet sends to the clientIOException
- if an input or output error is detected when the servlet handles the requestpublic final void handleRequest(InputStream input, OutputStream output) throws IOException
SkillServlet
determines the type of request and passes the request to
the configured Skill
.input
- - input stream of the request.output
- - output stream of the response.IOException
- if an input or output error is detected when the servlet handles the requestpublic void setProxy(Proxy proxy)
Proxy
object that this servlet may use if Request Signature Verification is enabled.proxy
- the Proxy
to associate with this servlet.Copyright © 2023. All rights reserved.