当前位置: 首页>>代码示例>>Java>>正文


Java Speechlet类代码示例

本文整理汇总了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);
}
 
开发者ID:KayLerch,项目名称:alexa-skills-kit-tellask-java,代码行数:10,代码来源:AlexaSpeechletServlet.java

示例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);
    }
}
 
开发者ID:kebernet,项目名称:skillz,代码行数:41,代码来源:SkillzFilter.java

示例3: TemplateSpeechletRequestStreamHandler

import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
public TemplateSpeechletRequestStreamHandler(Speechlet speechlet,
        Set<String> supportedApplicationIds) {
    super(speechlet, supportedApplicationIds);
}
 
开发者ID:jneong,项目名称:CS370_Echo_Demo,代码行数:5,代码来源:TemplateSpeechletRequestStreamHandler.java

示例4: getSpeechlet

import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public final Speechlet getSpeechlet() {
    return super.getSpeechlet();
}
 
开发者ID:KayLerch,项目名称:alexa-skills-kit-tellask-java,代码行数:8,代码来源:AlexaSpeechletServlet.java

示例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;
}
 
开发者ID:bellissimo,项目名称:AlexaSky,代码行数:6,代码来源:Launcher.java

示例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;
}
 
开发者ID:sidoh,项目名称:alexa_dispatcher,代码行数:6,代码来源:AlexaDispatcherServer.java

示例7: EchoQuerySpeechletRequestStreamHandler

import com.amazon.speech.speechlet.Speechlet; //导入依赖的package包/类
public EchoQuerySpeechletRequestStreamHandler(
    Speechlet speechlet, Set<String> supportedApplicationIds) {
  super(speechlet, supportedApplicationIds);
}
 
开发者ID:vqtran,项目名称:EchoQuery,代码行数:5,代码来源:EchoQuerySpeechletRequestStreamHandler.java


注:本文中的com.amazon.speech.speechlet.Speechlet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。