Java Code Examples for org.apache.cxf.frontend.ServerFactoryBean#setDestinationFactory()
The following examples show how to use
org.apache.cxf.frontend.ServerFactoryBean#setDestinationFactory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebServiceProtocol.java From dubbox with Apache License 2.0 | 6 votes |
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(); } }; }
Example 2
Source File: WebServiceProtocol.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
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(); } }; }
Example 3
Source File: WebServiceProtocol.java From dubbox with Apache License 2.0 | 6 votes |
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(); //升级到cxf 3后编译失败,暂时注掉 - 杨俊明 if (serverFactoryBean.getServer() != null) { serverFactoryBean.getServer().destroy(); } } }; }
Example 4
Source File: WebServiceProtocol.java From dubbox with Apache License 2.0 | 6 votes |
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(); } }; }
Example 5
Source File: WebServiceProtocol.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException { String addr = getAddr(url); 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() { @Override public void run() { if(serverFactoryBean.getServer()!= null) { serverFactoryBean.getServer().destroy(); } if(serverFactoryBean.getBus()!=null) { serverFactoryBean.getBus().shutdown(true); } } }; }
Example 6
Source File: EndpointImpl.java From cxf with Apache License 2.0 | 5 votes |
public void publish(javax.xml.ws.spi.http.HttpContext context) { ServerFactoryBean sf = getServerFactory(); if (sf.getDestinationFactory() == null) { sf.setDestinationFactory(new JAXWSHttpSpiTransportFactory(context)); } publish(context.getPath()); }
Example 7
Source File: ServerFactoryTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testSetDF() throws Exception { ServerFactoryBean svrBean = new ServerFactoryBean(); svrBean.setAddress("http://localhost/Hello"); svrBean.setServiceClass(HelloService.class); svrBean.setServiceBean(new HelloServiceImpl()); svrBean.setBus(getBus()); svrBean.setDestinationFactory(new CustomDestinationFactory()); ServerImpl server = (ServerImpl)svrBean.create(); assertTrue(server.getDestination() instanceof CustomDestination); }