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


Java SpeechletServlet类代码示例

本文整理汇总了Java中com.amazon.speech.speechlet.servlet.SpeechletServlet的典型用法代码示例。如果您正苦于以下问题:Java SpeechletServlet类的具体用法?Java SpeechletServlet怎么用?Java SpeechletServlet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SpeechletServlet类属于com.amazon.speech.speechlet.servlet包,在下文中一共展示了SpeechletServlet类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: alexaServlet

import com.amazon.speech.speechlet.servlet.SpeechletServlet; //导入依赖的package包/类
/**
 * Registers the {@link SpeechletServlet} at the application.
 *
 * @param speechlet Speechlet.
 * @return Registration.
 */
@Bean
public ServletRegistrationBean alexaServlet(WarehouseSpeechlet speechlet) {
    SpeechletServlet speechServlet = new SpeechletServlet();
    speechServlet.setSpeechlet(speechlet);

    ServletRegistrationBean servlet = new ServletRegistrationBean(speechServlet, "/alexa");
    servlet.setName("alexa");

    return servlet;
}
 
开发者ID:qaware,项目名称:iot-hessen-amazon-echo,代码行数:17,代码来源:WarehouseApplication.java

示例2: SpeechletServletDispatcher

import com.amazon.speech.speechlet.servlet.SpeechletServlet; //导入依赖的package包/类
public SpeechletServletDispatcher(SpeechletHandlerHolder handler) {
  this.handler = handler;

  try {
    Field field = SpeechletServlet.class.getDeclaredField("speechletRequestHandler");
    field.setAccessible(true);
    field.set(this, new LoggingServletSpeechletRequestHandler());
    field.setAccessible(false);
  }catch (Exception e){
    throw new RuntimeException("Could set logging aspect!", e);
  }

  this.setSpeechlet(this);
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:15,代码来源:SpeechletServletDispatcher.java

示例3: configure

import com.amazon.speech.speechlet.servlet.SpeechletServlet; //导入依赖的package包/类
private void configure(ServletContext ctx, String endpoint, SpeechletHandlerHolder handler) {
  final SpeechletServlet servlet = new SpeechletServletDispatcher(handler);

  ServletRegistration.Dynamic serviceServlet = ctx.addServlet("SpeechletServlet_" + (servletCount++), servlet);
  serviceServlet.addMapping(endpoint);
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:7,代码来源:SpeechletConfiguration.java

示例4: main

import com.amazon.speech.speechlet.servlet.SpeechletServlet; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    System.setProperty(Sdk.DISABLE_REQUEST_SIGNATURE_CHECK_SYSTEM_PROPERTY, "true");

    String envPort = System.getenv("PORT");
    int port = envPort == null || envPort.isEmpty() ? 8000 : Integer.valueOf(envPort);


    // Configure server and its associated servlets
    Server server = new Server(port);

    ServletContextHandler context = new ServletContextHandler();
    context.addEventListener(new GuiceServletContextListener() {
        @Override
        protected Injector getInjector() {
            Module services = new AbstractModule() {
                @Override
                protected void configure() {
                    bind(SpeechRouter.class).toProvider(new Provider<SpeechRouter>() {
                        @Inject Injector injector;

                        @Override
                        public SpeechRouter get() {
                            try {
                                return SpeechRouter.create(injector, "rottentomatoes");
                            } catch (Exception e) {
                                e.printStackTrace();
                                return null;
                            }
                        }
                    }).in(Singleton.class);
                    bind(AlexaSessionProvider.class).in(RequestScoped.class);
                    bind(RequestContextProvider.class).in(RequestScoped.class);
                    bind(SpeechletServlet.class).toProvider(new Provider<SpeechletServlet>() {
                        @Inject SpeechRouter router;
                        @Inject Injector injector;

                        @Override
                        public SpeechletServlet get() {
                            SpeechletServlet servlet = new SpeechletServlet();
                            servlet.setSpeechlet(new RoutingSpeechlet(router, injector));
                            return servlet;
                        }
                    }).in(Singleton.class);
                }
            };

            return Guice.createInjector(services, new ServletModule() {
                @Override
                protected void configureServlets() {
                    serve("/sample-utterances").with(SampleUtterancesServlet.class);
                    serve("/intent-schema").with(IntentSchemaServlet.class);
                    serve("/rotten-tomatoes").with(SpeechletServlet.class);
                }
            });
        }
    });
    context.addFilter(GuiceFilter.class, "/*", null);
    context.addServlet(DefaultServlet.class, "/");
    server.setHandler(context);
    server.start();
    server.join();
}
 
开发者ID:rs22,项目名称:alexa-routing,代码行数:63,代码来源:Main.java

示例5: createServlet

import com.amazon.speech.speechlet.servlet.SpeechletServlet; //导入依赖的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.servlet.SpeechletServlet; //导入依赖的package包/类
private static SpeechletServlet createServlet(final Speechlet speechlet) {
  SpeechletServlet servlet = new SpeechletServlet();
  servlet.setSpeechlet(speechlet);
  return servlet;
}
 
开发者ID:sidoh,项目名称:alexa_dispatcher,代码行数:6,代码来源:AlexaDispatcherServer.java


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