本文整理汇总了Java中org.apache.cxf.frontend.ServerFactoryBean类的典型用法代码示例。如果您正苦于以下问题:Java ServerFactoryBean类的具体用法?Java ServerFactoryBean怎么用?Java ServerFactoryBean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerFactoryBean类属于org.apache.cxf.frontend包,在下文中一共展示了ServerFactoryBean类的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: unregisterProcessor
import org.apache.cxf.frontend.ServerFactoryBean; //导入依赖的package包/类
@Override
public void unregisterProcessor(ProviderConfig providerConfig) {
if (!isStarted()) {
throw new InitErrorException("Server not started");
}
// 在httpserver中取消注册此jaxws服务
String url = "http://" + serverConfig.getHost() + ":" + serverConfig.getPort()
+ basePath + providerConfig.getInterfaceId();
LOGGER.info("Unregistry {} service to base path is ", serverConfig.getProtocolType(), url);
ServerFactoryBean svrFactory = exported.get(providerConfig);
if (svrFactory != null) {
try {
svrFactory.destroy();
} catch (Exception e) {
LOGGER.warn("Destroy ServerFactoryBean error, message is:{}", e);
} finally {
exported.remove(providerConfig);
}
}
}
示例3: 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();
}
};
}
示例4: 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();
}
示例5: 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();
}
示例6: 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;
}
示例7: 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;
}
}
示例8: 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();
}
};
}
示例9: CxfConsumer
import org.apache.cxf.frontend.ServerFactoryBean; //导入依赖的package包/类
public CxfConsumer(final CxfEndpoint endpoint, Processor processor) throws Exception {
super(endpoint, processor);
cxfEndpoint = endpoint;
// create server
ServerFactoryBean svrBean = endpoint.createServerFactoryBean();
svrBean.setInvoker(new CxfConsumerInvoker(endpoint));
server = svrBean.create();
// Apply the server configurer if it is possible
if (cxfEndpoint.getCxfEndpointConfigurer() != null) {
cxfEndpoint.getCxfEndpointConfigurer().configureServer(server);
}
if (ObjectHelper.isNotEmpty(endpoint.getPublishedEndpointUrl())) {
server.getEndpoint().getEndpointInfo().setProperty("publishedEndpointUrl", endpoint.getPublishedEndpointUrl());
}
}
示例10: 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();
}
示例11: 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();
}
示例12: 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);
}
示例13: init
import org.apache.cxf.frontend.ServerFactoryBean; //导入依赖的package包/类
@BeforeClass
public static void init() {
// publish a web-service
ServerFactoryBean factory = new ServerFactoryBean();
factory.setAddress(SERVICE_ADDRESS);
factory.setServiceBean(new HelloServiceImpl());
factory.create();
}
示例14: 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();
}
示例15: 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();
}