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


Java ResteasyDeployment.setApplication方法代码示例

本文整理汇总了Java中org.jboss.resteasy.spi.ResteasyDeployment.setApplication方法的典型用法代码示例。如果您正苦于以下问题:Java ResteasyDeployment.setApplication方法的具体用法?Java ResteasyDeployment.setApplication怎么用?Java ResteasyDeployment.setApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.resteasy.spi.ResteasyDeployment的用法示例。


在下文中一共展示了ResteasyDeployment.setApplication方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.jboss.resteasy.spi.ResteasyDeployment; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    String host = "0.0.0.0";
    int port = 8080;
    if (args.length > 0) {
        host = args[0];
    }
    if (args.length > 1) {
        port = Integer.parseInt(args[1]);
    }


    NettyJaxrsServer netty = new NettyJaxrsServer();
    ResteasyDeployment deployment = new ResteasyDeployment();
    deployment.setApplication(new MyApplication());
    netty.setDeployment(deployment);
    netty.setHostname(host);
    netty.setPort(port);
    netty.setRootResourcePath("/");
    netty.setSecurityDomain(null);
    netty.start();
}
 
开发者ID:smallnest,项目名称:Jax-RS-Performance-Comparison,代码行数:22,代码来源:Main.java

示例2: init

import org.jboss.resteasy.spi.ResteasyDeployment; //导入方法依赖的package包/类
@BeforeClass
public static void init() {
	server = new UndertowJaxrsServer();
	server.start();

	// deploy
	ResteasyDeployment deployment = new ResteasyDeployment();
	deployment.setApplication(new Config());
	server.deploy(deployment, "/",
			Collections.singletonMap("resteasy.resources", "com.holonplatform.json.gson.jaxrs.GsonFeature"),
			Collections.emptyMap());
}
 
开发者ID:holon-platform,项目名称:holon-json,代码行数:13,代码来源:TestResteasyIntegrationContext.java

示例3: main

import org.jboss.resteasy.spi.ResteasyDeployment; //导入方法依赖的package包/类
public static void main(String[] args) {
  final Builder builder = Undertow
      .builder()
      .setDirectBuffers(true)
      .setServerOption(UndertowOptions.ENABLE_HTTP2 , true);

  final Application jaxRsActivator = new Application() {
    @Override
    public Set<Class<?>> getClasses() {
      final Set<Class<?>> classes = new HashSet<>();
      classes.add(ServiceREST.class);
      classes.add(LoginREST.class);
      return classes;
    }
  };

  final String realRestPort = System.getProperty(REST_PORT_PROPERTY , DEFAULT_REST_PORT + "");
  final String realRestHost = System.getProperty(REST_HOST_PROPERTY , MainRest.DEFAULT_HOST);

  System.setProperty(RESTEASY_PORT_PROPERTY , realRestPort);
  System.setProperty(RESTEASY_HOST_PROPERTY , realRestHost);

  builder.addHttpListener(Integer.parseInt(realRestPort) , realRestHost);
  jaxrsServer = new UndertowJaxrsServer().start(builder);
  final ResteasyDeployment deployment = new ResteasyDeployment();
  deployment.setApplication(jaxRsActivator);
  jaxrsServer.deploy(jaxrsServer.undertowDeployment(deployment)
                                .setDeploymentName("Rest")
                                .setContextPath(CONTEXT_PATH_REST)
                                .setClassLoader(MainRest.class.getClassLoader()));
}
 
开发者ID:Java-Publications,项目名称:javamagazin-009-microkernel,代码行数:32,代码来源:MainRest.java

示例4: startHttpServer

import org.jboss.resteasy.spi.ResteasyDeployment; //导入方法依赖的package包/类
private void startHttpServer() throws PluginException {
    try {
        int port = Integer.parseInt(getConfig(HttpConstants.HTTP_PORT, "8018"));
        String host = getConfig(HttpConstants.HTTP_HOST, "0.0.0.0");
        int bossCount = Integer.parseInt(getConfig(HttpConstants.HTTP_BOSS_COUNT, "-1"));
        bossCount = bossCount < 0 ? Runtime.getRuntime().availableProcessors() * 2 : bossCount;
        int workCount = Integer.parseInt(getConfig(HttpConstants.HTTP_WORK_COUNT, "200"));

        LOG.info("Starting http server, listen on port->{}", port);
        netty = new NettyJaxrsServer();
        netty.setIoWorkerCount(bossCount);
        netty.setExecutorThreadCount(workCount);

        ResteasyDeployment deployment = new ResteasyDeployment();
        deployment.setProviderFactory(new ResteasyProviderFactory());
        // deployment.getProviderFactory().register(ResteasyJacksonProvider.class);
        deployment.setApplication(new ESApplication());
        netty.setDeployment(deployment);
        netty.setHostname(host);
        netty.setPort(port);
        netty.setRootResourcePath(HttpConstants.PATH_ROOT);

        netty.setSecurityDomain(null);
        if (isHttpsEnabled()) {
            // SelfSignedCertificate ssc = new SelfSignedCertificate();
            // netty.setSSLContext(SslContextBuilder.forServer(ssc.certificate(),
            // ssc.privateKey()).build());
        }

        netty.start();
        LOG.info("Start http server successfully!");
    } catch (Exception e) {
        throw new PluginException(e.getCause());
    }
}
 
开发者ID:dzh,项目名称:jframe,代码行数:36,代码来源:JfDemoESPlugin.java

示例5: getAttributes

import org.jboss.resteasy.spi.ResteasyDeployment; //导入方法依赖的package包/类
@Override
public Map<String, Object> getAttributes() {
    ResteasyDeployment deployment = new ResteasyDeployment();
    deployment.getActualResourceClasses().addAll(resteasyCdiExtension.getResources());
    deployment.getActualProviderClasses().addAll(resteasyCdiExtension.getProviders());
    if( !(applicationInstance.isUnsatisfied() || applicationInstance.isAmbiguous())) {
        deployment.setApplication(applicationInstance.get());
    }
    deployment.setInjectorFactoryClass(Cdi11InjectorFactory.class.getName());
    return singletonMap(ResteasyDeployment.class.getName(), deployment);
}
 
开发者ID:hammock-project,项目名称:hammock,代码行数:12,代码来源:ResteasyServletContextAttributeProvider.java


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