public void start() {
ResteasyDeployment dp = new ResteasyDeployment();
Collection<Object> providers = ac.getBeansWithAnnotation(Provider.class).values();
Collection<Object> controllers = ac.getBeansWithAnnotation(Controller.class).values();
Assert.notEmpty(controllers);
// extract providers
if (providers != null) {
dp.getProviders().addAll(providers);
}
// extract only controller annotated beans
dp.getResources().addAll(controllers);
Map<String, Object> channelOptions = new HashMap<String, Object>();
channelOptions.put("reuseAddress", true);
List<ChannelHandler> channelHandlerList = new ArrayList<ChannelHandler>();
channelHandlerList.add(channelHandler);
channelHandlerList.add(idleStateHandler);
channelHandlerList.add(healthCheckHandler);
netty = new NettyJaxrsServer();
netty.setChannelOptions(channelOptions);
netty.setDeployment(dp);
netty.setPort(port);
netty.setRootResourcePath("/resteasy");
netty.setIoWorkerCount(ioWorkerCount);
netty.setExecutorThreadCount(executorThreadCount);
netty.setMaxRequestSize(maxRequestSize);
netty.setSSLContext(sslContext);
netty.setKeepAlive(true);
netty.setChannelHandlers(channelHandlerList);
netty.setSecurityDomain(null);
netty.start();
}
NettyServer.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:Netty-Resteasy-Spring
作者:
评论列表
文章目录