本文整理汇总了Java中org.apache.cxf.frontend.ServerFactoryBean.setServiceClass方法的典型用法代码示例。如果您正苦于以下问题:Java ServerFactoryBean.setServiceClass方法的具体用法?Java ServerFactoryBean.setServiceClass怎么用?Java ServerFactoryBean.setServiceClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.frontend.ServerFactoryBean
的用法示例。
在下文中一共展示了ServerFactoryBean.setServiceClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setUp
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
deleteDirectory("target/filetocxf");
// set CXF
ServerFactoryBean factory = new ServerFactoryBean();
factory.setAddress("http://localhost:" + port1 + "/FileToCxfMessageDataFormatTest/router");
factory.setServiceClass(HelloService.class);
factory.setServiceBean(new HelloServiceImpl());
server = factory.create();
server.start();
super.setUp();
}
示例4: 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();
}
示例5: createLocalService
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
/**
* 构造服务,注意要自己释放
* @param intf
* @param bean
* @return
*/
private Server createLocalService(Class<?> intf, Object bean) {
String url = "local://" + intf.getName();
ServiceDefinition ws = getFactory().processServiceDef(new ServiceDefinition(intf.getSimpleName(), intf, bean));
if (ws == null)
return null;
ServerFactoryBean sf = new ServerFactoryBean(new CXFPlusServiceBean());
sf.setAddress(url);
sf.setServiceBean(ws.getServiceBean());
sf.setServiceClass(ws.getServiceClass());
if (printTrace()){
sf.getInInterceptors().add(new LoggingInInterceptor());
sf.getOutInterceptors().add(new LoggingOutInterceptor());
}
Server server = sf.create();
return server;
}
示例6: 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;
}
}
示例7: 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();
}
};
}
示例8: startService
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@BeforeClass
public static void startService() {
//start a service
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress(SERVICE_ADDRESS);
svrBean.setServiceClass(HelloService.class);
svrBean.setServiceBean(new HelloServiceImpl());
server = svrBean.create();
}
示例9: startService
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@Before
public void startService() {
//start a service
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress(getServiceAddress());
svrBean.setServiceClass(HelloService.class);
svrBean.setServiceBean(new HelloServiceImpl());
configureFactory(svrBean);
server = svrBean.create();
server.start();
}
示例10: 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);
}
示例11: 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();
}
示例12: startService
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@BeforeClass
public static void startService() {
//start a service
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress(SERVICE_ADDRESS);
svrBean.setServiceClass(HelloService.class);
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setBindingId(getBindingId());
Server server = svrBean.create();
server.start();
}
示例13: startService
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
@BeforeClass
public static void startService() {
//start a service
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress(SERVICE_ADDRESS);
svrBean.setServiceClass(HelloService.class);
svrBean.setServiceBean(new HelloServiceImpl());
server = svrBean.create();
server.start();
}
示例14: init
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
public static synchronized void init() {
// Retrieve or launch a Jetty server
// in case of a local exposition
HTTPServer httpServer = HTTPServer.get();
if (httpServer.isMapped(WSConstants.SERVLET_PATH)) {
logger.info("The CXF servlet has already been installed");
return;
}
// Creates a CXF servlet and register it
// to the Jetty server
CXFServlet cxf = new CXFServlet();
ServletHolder CXFServletHolder = new ServletHolder(cxf);
httpServer.registerServlet(CXFServletHolder, WSConstants.SERVLET_PATH);
// Configures the bus
Bus bus = cxf.getBus();
BusFactory.setDefaultBus(bus);
/*
* Configure the service
*/
ServerFactoryBean svrFactory = new ServerFactoryBean();
svrFactory.setAddress("/ServiceDeployer");
svrFactory.setServiceClass(ServiceDeployerItf.class);
svrFactory.setServiceBean(new ServiceDeployer());
if (logger.getLevel() != null && logger.getLevel() == Level.DEBUG) {
/*
* Attaches in-interceptors
* In our case, only a logger is attached in order to be able
* to see input soap messages
*/
LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
svrFactory.getInInterceptors().add(loggingInInterceptor);
/*
* Attaches out-interceptors
* In our case, only a logger is attached in order to be able
* to see output soap messages
*/
LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
svrFactory.getOutInterceptors().add(loggingOutInterceptor);
}
// Creates the service
svrFactory.create();
}
示例15: publishBean
import org.apache.cxf.frontend.ServerFactoryBean; //导入方法依赖的package包/类
protected void publishBean() {
ServerFactoryBean srvFactory = new ServerFactoryBean();
srvFactory.setServiceClass(ServiceForExportation.class);
srvFactory.setServiceBean(id);
srvFactory.setAddress("/" + srvFactory.getServiceClass().getSimpleName());
org.apache.cxf.endpoint.Server endpoint = srvFactory.create();
srvFactory.getServer().start();
}