本文整理汇总了Java中org.apache.cxf.frontend.ServerFactoryBean.setBus方法的典型用法代码示例。如果您正苦于以下问题:Java ServerFactoryBean.setBus方法的具体用法?Java ServerFactoryBean.setBus怎么用?Java ServerFactoryBean.setBus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.frontend.ServerFactoryBean
的用法示例。
在下文中一共展示了ServerFactoryBean.setBus方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExport
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
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();
}
};
}
示例2: doExport
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws JahhanException {
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();
}
};
}
示例3: loadBus
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@Override
public void loadBus(ServletConfig servletConfig) throws ServletException {
super.loadBus(servletConfig);
// TODO: Hacky first version to get default Process Engine
ProcessEngine processEngine = ProcessEngineConfiguration
.createProcessEngineConfigurationFromResourceDefault()
.buildProcessEngine();
Bus bus = getBus();
BusFactory.setDefaultBus(bus);
Endpoint.publish("/RuntimeService", new RuntimeWebServiceImpl(processEngine));
// You can als use the simple frontend API to do this
ServerFactoryBean factory = new ServerFactoryBean();
factory.setBus(bus);
factory.setServiceClass(RuntimeWebServiceImpl.class);
factory.setAddress("/RuntimeService");
factory.create();
}
示例4: addService
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
/**
* Creates a webservice endpoint for an interface/implementation pair based on their fullnames<p>
* Classes and Interfaces to be used as webservice should be made available in the pom.xml
*
* @param serviceInterface The interface fullname of the webservice to be added
* @param serviceImplementation The implementation class fullname of the webservice to be added
* @throws Exception
* @see WebServiceServlet, ServerFactoryBean
*/
public void addService(String serviceInterface, String serviceImplementation) throws Exception
{
String serviceName = extractServiceName(serviceInterface);
ServerFactoryBean svrFactory = new ServerFactoryBean();
try {
if(bus != null) {
svrFactory.setBus(bus);
}
svrFactory.setServiceClass(Class.forName(serviceInterface));
svrFactory.setAddress(baseAddress + serviceName);
svrFactory.setServiceBean(Class.forName(serviceImplementation).newInstance());
svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
svrFactory.create();
System.out.println(svrFactory.getServiceFactory().getEndpointInfo().getAddress());
} catch (Exception e) {
logger.error("Error adding webservices with interface : " + serviceInterface + " and implementation : " + serviceImplementation, e);
throw e;
}
}
示例5: doExport
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
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() {
public void run() {
serverFactoryBean.destroy();
}
};
}
示例6: startService
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@Before
public void startService() throws Exception {
// start a simple front service
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress(getSimpleServerAddress());
svrBean.setServiceClass(HelloService.class);
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setBus(BusFactory.getDefaultBus());
server = svrBean.create();
GreeterImpl greeterImpl = new GreeterImpl();
endpoint = Endpoint.publish(getJaxWsServerAddress(), greeterImpl);
}
示例7: startServer
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@BeforeClass
public static void startServer() throws Exception {
// start a simple front service
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress(SIMPLE_SERVER_ADDRESS);
svrBean.setServiceClass(HelloService.class);
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setBus(BusFactory.getDefaultBus());
svrBean.create();
}
示例8: useExportDeclaration
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@Override
public void useExportDeclaration(ExportDeclaration exportDeclaration) throws BinderException {
LOG.info("exporting {}", exportDeclaration.getMetadata());
JAXWSExportDeclarationWrapper pojo = JAXWSExportDeclarationWrapper.create(exportDeclaration);
try {
ServerFactoryBean srvFactory = new ServerFactoryBean();
Class ref = FuchsiaUtils.loadClass(this.context, pojo.getClazz());
srvFactory.setServiceClass(ref);
srvFactory.setBus(cxfbus);
ServiceReference[] jaxWsReferences = context.getAllServiceReferences(pojo.getClazz(), pojo.getFilter());
if (jaxWsReferences == null) {
LOG.warn("instance not found to be exported, ignoring exportation request, filter:" + pojo.getFilter());
return;
}
Object object = context.getService(jaxWsReferences[0]);
srvFactory.setServiceBean(object);
srvFactory.setAddress(pojo.getWebcontext());
org.apache.cxf.endpoint.Server endpoint = srvFactory.create();
exportDeclaration.handle(serviceReference);
exportedDeclaration.put(pojo.getWebcontext(), endpoint);
srvFactory.getServer().start();
LOG.info("Pushing CXF endpoint: {}", endpoint.getEndpoint().getEndpointInfo().getAddress());
} catch (Exception e) {
LOG.error("Failed exporting in CXF", e);
throw new BinderException(e);
}
}