本文整理汇总了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();
}
示例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());
}
示例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()));
}
示例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());
}
}
示例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);
}