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


Java HttpServletDispatcher类代码示例

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


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

示例1: startComponent

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
@Override
public void startComponent() {
  // Initialize servlet using RESTEasy and it's Guice bridge.
  // The listener must be injected by the same Guice module which also binds the REST endpoints.
  ServletContextHandler servletHandler = new ServletContextHandler();
  servletHandler.addEventListener(listener);
  servletHandler.addServlet(HttpServletDispatcher.class, "/*");

  // Starting up Jetty to serve the REST API.
  server = new Server(port);
  server.setHandler(servletHandler);

  try {
    server.start();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:19,代码来源:ApiServer.java

示例2: main

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
  Injector injector = Guice.createInjector(getModules(args));
  
  Server server = new Server(injector.getInstance(Key.get(Integer.class, Port.class)));
  ServletContextHandler handler = new ServletContextHandler(server, "/pvwatts");
  
  handler.addEventListener(injector.getInstance(
    GuiceResteasyBootstrapServletContextListener.class));

  ServletHolder sh = new ServletHolder(HttpServletDispatcher.class);
  handler.addServlet(sh, "/*");
  server.setHandler(handler);

  server.start();
  server.join();
}
 
开发者ID:spharris,项目名称:pvwatts-java,代码行数:17,代码来源:PvWattsServer.java

示例3: ServerRuntime

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
public ServerRuntime(Options options,
                     GuiceResteasyBootstrapServletContextListener resteasyContextListener,
                     SwaggerServletContextListener swaggerContextListener,
                     HttpServletDispatcher httpServletDispatcher,
                     SecurityHandler securityHandler,
                     @Named("system.environment") String environment,
                     @Named("systemRuntime.resourceDir") String resourceDir) {
    this.options = options;
    this.resteasyContextListener = resteasyContextListener;
    this.swaggerContextListener = swaggerContextListener;
    this.httpServletDispatcher = httpServletDispatcher;
    this.securityHandler = securityHandler;
    this.environment = environment;
    this.resourceDir = resourceDir;
    RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
}
 
开发者ID:labsai,项目名称:EDDI,代码行数:17,代码来源:ServerRuntime.java

示例4: main

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    final Server server = new Server(4080);
    final ServletContextHandler servletContextHandler = new ServletContextHandler();
    servletContextHandler.setContextPath("/");
    servletContextHandler.setInitParameter("javax.ws.rs.Application", ElideResourceConfig.class.getName());
    server.setHandler(servletContextHandler);

    final ServletHolder servletHolder = servletContextHandler.addServlet(HttpServletDispatcher.class, "/*");
    servletHolder.setInitOrder(1);

    log.info("Web service starting...");
    server.start();

    log.info("Web service running...");
    server.join();
    server.destroy();
}
 
开发者ID:yahoo,项目名称:elide,代码行数:18,代码来源:Main.java

示例5: beforeClass

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception
{
    RiskDataRepository riskDataRepository = RiskDataRepositoryFactory.create(new HibernateSessionProviderImpl());
    RiskDataRepositoryProvider.setRiskDataRepository(riskDataRepository);

    server = new Server(PORT);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
    context.setContextPath("/");
    ServletHolder holder = new ServletHolder(new HttpServletDispatcher());
    holder.setInitParameter("javax.ws.rs.Application", "eu.riscoss.rdr.RiskDataRepositoryApplication");
    context.addServlet(holder, "/*");
    server.setHandler(context);
    server.start();

    gson = new Gson();
}
 
开发者ID:RISCOSS,项目名称:riscoss-githubanalyzer,代码行数:18,代码来源:RiskDataRepositoryRESTAPITest.java

示例6: main

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
  PcapServiceCli cli = new PcapServiceCli(args);
  cli.parse();
  ConfigurationUtil.setPcapOutputPath(cli.getPcapHdfsPath());
  LOG.info("Pcap location set to {}", cli.getPcapHdfsPath());
  ConfigurationUtil.setTempQueryOutputPath(cli.getQueryHdfsPath());
  LOG.info("Query temp location set to {}", cli.getQueryHdfsPath());
  Server server = new Server(cli.getPort());
  ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
  context.setContextPath("/");
  ServletHolder h = new ServletHolder(new HttpServletDispatcher());
  h.setInitParameter("javax.ws.rs.Application", "org.apache.metron.pcapservice.rest.JettyServiceRunner");
  context.addServlet(h, "/*");
  server.setHandler(context);
  try {
    server.start();
    server.join();
  } catch (Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:apache,项目名称:metron,代码行数:22,代码来源:PcapService.java

示例7: setup

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
@BeforeMethod
public void         setup() throws Exception
{
    RestEasyApplication.singletonsRef.set(new RestEasySingletons());

    ResteasyProviderFactory.setInstance(new ResteasyProviderFactory());

    HttpServletDispatcher   dispatcher = new HttpServletDispatcher();

    port = InstanceSpec.getRandomPort();
    server = new Server(port);
    Context root = new Context(server, "/", Context.SESSIONS);
    root.getInitParams().put("javax.ws.rs.Application", RestEasyApplication.class.getName());
    root.addServlet(new ServletHolder(dispatcher), "/*");
    root.addEventListener(new ResteasyBootstrap());
    server.start();
}
 
开发者ID:apache,项目名称:curator,代码行数:18,代码来源:TestStringsWithRestEasy.java

示例8: main

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
public static void main(String[] args) throws IOException {

		PcapServiceCli cli = new PcapServiceCli(args);
		cli.parse();
		
		Server server = new Server(cli.getPort());
		ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
		context.setContextPath("/");
		ServletHolder h = new ServletHolder(new HttpServletDispatcher());
		h.setInitParameter("javax.ws.rs.Application", "com.opensoc.pcapservice.rest.JettyServiceRunner");
		context.addServlet(h, "/*");
		server.setHandler(context);
		try {
			server.start();
			server.join();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
 
开发者ID:OpenSOC,项目名称:opensoc-streaming,代码行数:20,代码来源:PcapService.java

示例9: GitServerHandler

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
private GitServerHandler(final Config config, final Module... overrides) {
	addEventListener(new GuiceResteasyBootstrapServletContextListener() {
		@Override
		protected List<Module> getModules(ServletContext context) {
			return ImmutableList.<Module> of(Modules.override(new GitServerModule(config)).with(overrides));
		}

		@Override
		protected void withInjector(Injector injector) {
			injectorAtomicReference.set(injector);
			// No interaction with injector required. Skipping...
		}
	});

	addServlet(HttpServletDispatcher.class, "/");
}
 
开发者ID:devhub-tud,项目名称:git-server,代码行数:17,代码来源:GitServer.java

示例10: executeCommand

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
@Override
public void executeCommand() {
    ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(classLoader);
    try {
        for (final Object o : registeredDispatchers) {
            if (o.getClass().getName().equals("org.jboss.resteasy.plugins.server.servlet.FilterDispatcher")) {
                reinitializeFilterDispatcher((FilterDispatcher) o);
            }
            if (o.getClass().getName().equals("org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher")) {
                reinitializeServletDispatcher((HttpServletDispatcher) o);
            }
        }
    } finally {
        Thread.currentThread().setContextClassLoader(oldClassLoader);
    }
}
 
开发者ID:HotswapProjects,项目名称:HotswapAgent,代码行数:18,代码来源:RefreshDispatchersCommand.java

示例11: main

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Injector injector = Guice.createInjector(new HelloModule(args));

    injector.getAllBindings();

    injector.createChildInjector().getAllBindings();

    Server server = new Server(8080);
    ServletContextHandler servletHandler = new ServletContextHandler();
    servletHandler.addEventListener(injector.getInstance(GuiceResteasyBootstrapServletContextListener.class));

    ServletHolder sh = new ServletHolder(HttpServletDispatcher.class);
    servletHandler.setInitParameter("resteasy.role.based.security", "true");
    servletHandler.addFilter(new FilterHolder(injector.getInstance(HelloFilter.class)), "/*", null);
    //servletHandler.addServlet(DefaultServlet.class, "/*");
    servletHandler.addServlet(sh, "/*");

    server.setHandler(servletHandler);
    server.start();
    server.join();
}
 
开发者ID:szymex,项目名称:Embedded-Jetty-RESTEasy-Guice-Example,代码行数:22,代码来源:Main.java

示例12: addModulesToJetty

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
/**
 * Configure the web application(s).
 * @param handlers
 * @throws Exception
 */
protected void addModulesToJetty(ContextHandlerCollection handlers) throws Exception {
    /* *************
     * Gateway
     * ************* */
    ServletContextHandler server = new ServletContextHandler(ServletContextHandler.SESSIONS);
    server.setContextPath("/");
    server.addEventListener(new WarGatewayBootstrapper());
    ServletHolder servlet = new ServletHolder(new WarGatewayServlet());
    server.addServlet(servlet, "/gateway/*");
    servlet = new ServletHolder(new HttpServletDispatcher());
    servlet.setInitParameter("javax.ws.rs.Application", TestGatewayApplication.class.getName());
    servlet.setInitParameter("resteasy.servlet.mapping.prefix", "/api");
    servlet.setInitOrder(1);
    server.addServlet(servlet, "/api/*");

    // Add the web contexts to jetty
    handlers.addHandler(server);
}
 
开发者ID:apiman,项目名称:apiman,代码行数:24,代码来源:GatewayServer.java

示例13: forNonEE6Container

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
/**
 * Uses the production web.xml, but enriches it with standalone Weld and RESTEasy so it may run
 * more portably in non full EE profile containers like Jetty or Tomcat.
 */
public static Document forNonEE6Container(Class<? extends Application> restApplicationClass) throws ParserConfigurationException, IOException, SAXException {
    DocumentBuilder docBuilder = documentBuilder();
    Document webXml = docBuilder.parse(Paths.get("src/main/webapp/WEB-INF/web.xml").toFile());
    Node webApp = webXml.getFirstChild();

    webApp.appendChild(webXml.createElement("listener"))
            .appendChild(webXml.createElement("listener-class"))
            .appendChild(webXml.createTextNode("org.jboss.weld.environment.servlet.Listener"));

    Node restEasy = webApp.appendChild(webXml.createElement("servlet"));
    restEasy.appendChild(webXml.createElement("servlet-name"))
            .appendChild(webXml.createTextNode(RESTEASY_SERVLET_NAME));
    restEasy.appendChild(webXml.createElement("servlet-class"))
            .appendChild(webXml.createTextNode(HttpServletDispatcher.class.getName()));
    Node restEasyParams = restEasy.appendChild(webXml.createElement("init-param"));
    restEasyParams.appendChild(webXml.createElement("param-name"))
            .appendChild(webXml.createTextNode("javax.ws.rs.Application"));
    restEasyParams.appendChild(webXml.createElement("param-value"))
            .appendChild(webXml.createTextNode(restApplicationClass.getName()));

    Node restEasyMapping = webApp.appendChild(webXml.createElement("servlet-mapping"));
    restEasyMapping.appendChild(webXml.createElement("servlet-name"))
            .appendChild(webXml.createTextNode(RESTEASY_SERVLET_NAME));
    restEasyMapping.appendChild(webXml.createElement("url-pattern"))
            .appendChild(webXml.createTextNode("/*"));

    return webXml;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:33,代码来源:CrudWebXmls.java

示例14: configure

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
@Override
public void configure() {
    binder().requireExplicitBindings();
    bind(GuiceResteasyBootstrapServletContextListener.class).in(Scopes.SINGLETON);

    bind(ObjectMapper.class).toProvider(this::customMapper).asEagerSingleton();

    bind(GuiceFilter.class);
    bind(HttpServletDispatcher.class).in(Scopes.SINGLETON);

    install(new HealthModule());
}
 
开发者ID:benhardy,项目名称:lilrest,代码行数:13,代码来源:JaxRsServerModule.java

示例15: JaxRsServer

import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher; //导入依赖的package包/类
protected JaxRsServer() {

        final Injector injector = Guice.createInjector(
                new ConfigModule(),
                new JaxRsServerModule(),
                getMainModule(),
                new ServletModule() {
                    @Override
                    public void configureServlets() {
                        serve("/*").with(HttpServletDispatcher.class);
                    }
                }
        );
        injector.injectMembers(this);
    }
 
开发者ID:benhardy,项目名称:lilrest,代码行数:16,代码来源:JaxRsServer.java


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