use of com.alibaba.dubbo.remoting.http.HttpServer in project dubbo by alibaba.
the class HessianProtocol method doExport.
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
String addr = url.getIp() + ":" + url.getPort();
HttpServer server = serverMap.get(addr);
if (server == null) {
server = httpBinder.bind(url, new HessianHandler());
serverMap.put(addr, server);
}
final String path = url.getAbsolutePath();
HessianSkeleton skeleton = new HessianSkeleton(impl, type);
skeletonMap.put(path, skeleton);
return new Runnable() {
public void run() {
skeletonMap.remove(path);
}
};
}
use of com.alibaba.dubbo.remoting.http.HttpServer in project dubbo by alibaba.
the class WebServiceProtocol method doExport.
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
String addr = url.getIp() + ":" + url.getPort();
HttpServer httpServer = serverMap.get(addr);
if (httpServer == null) {
httpServer = httpBinder.bind(url, new WebServiceHandler());
serverMap.put(addr, httpServer);
}
final ServerFactoryBean serverFactoryBean = new ServerFactoryBean();
serverFactoryBean.setAddress(url.getAbsolutePath());
serverFactoryBean.setServiceClass(type);
serverFactoryBean.setServiceBean(impl);
serverFactoryBean.setBus(bus);
serverFactoryBean.setDestinationFactory(transportFactory);
serverFactoryBean.create();
return new Runnable() {
public void run() {
serverFactoryBean.destroy();
}
};
}
use of com.alibaba.dubbo.remoting.http.HttpServer in project dubbo by alibaba.
the class HttpProtocol method doExport.
protected <T> Runnable doExport(final T impl, Class<T> type, URL url) throws RpcException {
String addr = url.getIp() + ":" + url.getPort();
HttpServer server = serverMap.get(addr);
if (server == null) {
server = httpBinder.bind(url, new InternalHandler());
serverMap.put(addr, server);
}
final HttpInvokerServiceExporter httpServiceExporter = new HttpInvokerServiceExporter();
httpServiceExporter.setServiceInterface(type);
httpServiceExporter.setService(impl);
try {
httpServiceExporter.afterPropertiesSet();
} catch (Exception e) {
throw new RpcException(e.getMessage(), e);
}
final String path = url.getAbsolutePath();
skeletonMap.put(path, httpServiceExporter);
return new Runnable() {
public void run() {
skeletonMap.remove(path);
}
};
}
Aggregations