本文整理汇总了Java中com.amazon.speech.speechlet.Speechlet类的典型用法代码示例。如果您正苦于以下问题:Java Speechlet类的具体用法?Java Speechlet怎么用?Java Speechlet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Speechlet类属于com.amazon.speech.speechlet包,在下文中一共展示了Speechlet类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSpeechlet
import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final void setSpeechlet(final Speechlet speechlet) {
// enforce speechlet which extends AlexaSpeechlet
Validate.isInstanceOf(AlexaSpeechlet.class, speechlet, "Servlet expects a speechlet extending AlexaSpeechlet.");
super.setSpeechlet(speechlet);
}
示例2: doFilter
import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
String path = request.getRequestURI();
if(path.startsWith(pathPrefix)){
path = path.substring(pathPrefix.length(), path.length());
}
if(!path.startsWith("/")){
path = "/"+path;
}
LOGGER.finer("Checking for Skill at "+path +" (prefix: "+pathPrefix+" requestURI: "+request.getRequestURI());
if(!Strings.isNullOrEmpty(path)){
Optional<IntrospectionData> handler = registry.getDataForPath(path);
if(!handler.isPresent()){ // Nothing to handle.
chain.doFilter(request, response);
return;
}
IntrospectionData data = handler.get();
LOGGER.finer("Handling skill request for "+path+" with "+data.getType());
Object instance = factory.create(data.getType());
final ArrayListMultimap<String, InvokableMethod> methods = ArrayListMultimap.create();
data.getMethods().forEach(m->methods.put(m.getName(), m));
// Check a servlet out and invoke it.
DynamicSpeechlet speechlet = new DynamicSpeechlet(methods, data, mappings, registry, instance, factory);
DynamicServlet servlet;
try {
servlet = pool.checkout();
} catch (RuntimeException e) {
throw new ServletException(e);
}
servlet.setSpeechlet(speechlet);
servlet.service(req, res);
servlet.setSpeechlet((Speechlet) null);
pool.checkin(servlet);
}
}
示例3: TemplateSpeechletRequestStreamHandler
import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
public TemplateSpeechletRequestStreamHandler(Speechlet speechlet,
Set<String> supportedApplicationIds) {
super(speechlet, supportedApplicationIds);
}
示例4: getSpeechlet
import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final Speechlet getSpeechlet() {
return super.getSpeechlet();
}
示例5: createServlet
import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
private static SpeechletServlet createServlet(final Speechlet speechlet) {
SpeechletServlet servlet = new SpeechletServlet();
servlet.setSpeechlet(speechlet);
return servlet;
}
示例6: createServlet
import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
private static SpeechletServlet createServlet(final Speechlet speechlet) {
SpeechletServlet servlet = new SpeechletServlet();
servlet.setSpeechlet(speechlet);
return servlet;
}
示例7: EchoQuerySpeechletRequestStreamHandler
import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
public EchoQuerySpeechletRequestStreamHandler(
Speechlet speechlet, Set<String> supportedApplicationIds) {
super(speechlet, supportedApplicationIds);
}