本文整理了Java中org.apache.cxf.Bus
类的一些代码示例,展示了Bus
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bus
类的具体详情如下:
包路径:org.apache.cxf.Bus
类名称:Bus
[英]The Bus is the central place in CXF. Its primary responsibility is providing access to the different extensions (such as the DestinationFactoryManager, ConduitFactoryManager, BindingFactoryManager, etc). Depending on the implementation of the Bus it may also be responsible for wiring up the CXF internals.
[中]总线是CXF的中心位置。它的主要职责是提供对不同扩展的访问(如DestinationFactoryManager、CondituitFactoryManager、BindingFactoryManager等)。根据总线的实施情况,它还可能负责连接CXF内部构件。
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
final void initialize(Bus b, URL url, WebServiceFeature ... f) {
if (b == null) {
b = BusFactory.getThreadDefaultBus(true);
bus.getExtension(ServiceContractResolverRegistry.class);
if (null != registry) {
URI uri = registry.getContractLocation(serviceName);
wsdlURL = url == null ? null : url.toString();
代码示例来源:origin: apache/incubator-dubbo
@Override
public void run() {
if(serverFactoryBean.getServer()!= null) {
serverFactoryBean.getServer().destroy();
}
if(serverFactoryBean.getBus()!=null) {
serverFactoryBean.getBus().shutdown(true);
}
}
};
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
protected DestinationRegistry getDestinationRegistryFromBusOrDefault(final String transportId) {
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
try {
String peferredTransportId = transportId;
peferredTransportId = (String)getBus().getProperty(AbstractTransportFactory.PREFERRED_TRANSPORT_ID);
代码示例来源:origin: apache/cxf
@org.junit.Test
public void testSignedSAML() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL busFile = ActionTest.class.getResource("client.xml");
Bus bus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl");
Service service = Service.create(wsdl, SERVICE_QNAME);
QName portQName = new QName(NAMESPACE, "DoubleItSignedSAMLPort");
DoubleItPortType port =
service.getPort(portQName, DoubleItPortType.class);
updateAddressPort(port, PORT);
assertEquals(50, port.doubleIt(25));
((java.io.Closeable)port).close();
bus.shutdown(true);
}
代码示例来源:origin: apache/cxf
@Test
public void testHttpWrappedContinuations() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
Bus bus = bf.createBus(CLIENT_CONFIG_FILE);
BusFactory.setDefaultBus(bus);
QName serviceName = new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService");
URL wsdlURL = new URL("http://localhost:" + PORT + "/hellocontinuation?wsdl");
HelloContinuationService service = new HelloContinuationService(wsdlURL, serviceName);
assertNotNull(service);
final HelloContinuation helloPort = service.getHelloContinuationPort();
doTest(helloPort);
bus.shutdown(true);
}
代码示例来源:origin: apache/cxf
@Test
public void testClientServer() throws Exception {
Bus bus = new SpringBusFactory().createBus("org/apache/cxf/systest/ws/security/handler/client.xml");
BusFactory.setDefaultBus(bus);
BusFactory.setThreadDefaultBus(bus);
Service service = Service.create(new URL("http://localhost:" + PORT + "/wsse/HelloWorldWS?wsdl"),
new QName("http://cxf.apache.org/wsse/handler/helloworld",
"HelloWorldImplService"));
QName portName = new QName("http://cxf.apache.org/wsse/handler/helloworld", "HelloWorldPort");
HelloWorld port = service.getPort(portName, HelloWorld.class);
updateAddressPort(port, PORT);
assertEquals("Hello CXF", port.sayHello("CXF"));
bus.shutdown(true);
}
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
Bus bus = BusFactory.getThreadDefaultBus();
WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
try {
Definition def = wsdlManager.getDefinition(wsdlDocumentLocation);
interfaceName = def.getService(serviceName).getPort(portName.getLocalPart()).getBinding()
.getPortType().getQName();
} catch (Exception e) {
? serviceName.getNamespaceURI() + " " + wsdlDocumentLocation
: wsdlDocumentLocation;
writer.writeNamespace(JAXWSAConstants.WSDLI_PFX,
JAXWSAConstants.WSAM_INTERFACE_NAME,
JAXWSAConstants.NS_WSAM);
String portTypePrefix = interfaceName.getPrefix();
if (portTypePrefix == null || portTypePrefix.isEmpty()) {
portTypePrefix = "ns1";
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
protected ClassLoader initClassLoader() {
return bus.getExtension(ClassLoader.class);
}
代码示例来源:origin: apache/cxf
private static synchronized MAPCodec createMAPCodec(Bus bus) {
MAPCodec mc = bus.getExtension(MAPCodec.class);
if (mc == null) {
bus.setExtension(new MAPCodec(), MAPCodec.class);
mc = bus.getExtension(MAPCodec.class);
}
return mc;
}
代码示例来源:origin: apache/cxf
@org.junit.Test
public void testGetWSDL() throws Exception {
BusFactory bf = BusFactory.newInstance();
Bus bus = bf.createBus();
bus.getInInterceptors().add(new LoggingInInterceptor());
bus.getOutInterceptors().add(new LoggingOutInterceptor());
MyHTTPConduitConfigurer myHttpConduitConfig = new MyHTTPConduitConfigurer();
bus.setExtension(myHttpConduitConfig, HTTPConduitConfigurer.class);
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(bus);
factory.createClient(ADDRESS + "?wsdl");
}
代码示例来源:origin: apache/cxf
public void setUpBus(String port) throws Exception {
SpringBusFactory bf = new SpringBusFactory();
bus = bf.createBus("org/apache/cxf/systest/ws/policy/rmwsdl.xml");
BusFactory.setDefaultBus(bus);
outRecorder = new OutMessageRecorder();
bus.getOutInterceptors().add(outRecorder);
inRecorder = new InMessageRecorder();
bus.getInInterceptors().add(inRecorder);
}
}
代码示例来源:origin: opensourceBIM/BIMserver
public void loadBus(ServletConfig servletConfig) {
this.bus = BusFactory.newInstance().createBus();
Bus bus = getBus();
HeaderManager headerManager = bus.getExtension(HeaderManager.class);
headerManager.registerHeaderProcessor(new HeaderProcessor() {
@Override
BusFactory.setDefaultBus(bus);
代码示例来源:origin: org.apache.cxf/cxf-rt-rs-client
protected static PhaseInterceptorChain setupOutInterceptorChain(ClientConfiguration cfg) {
PhaseManager pm = cfg.getBus().getExtension(PhaseManager.class);
List<Interceptor<? extends Message>> i1 = cfg.getBus().getOutInterceptors();
List<Interceptor<? extends Message>> i2 = cfg.getOutInterceptors();
List<Interceptor<? extends Message>> i3 = cfg.getConduitSelector().getEndpoint().getOutInterceptors();
PhaseInterceptorChain chain = new PhaseChainCache().get(pm.getOutPhases(), i1, i2, i3);
chain.add(new ClientRequestFilterInterceptor());
return chain;
}
代码示例来源:origin: apache/cxf
@org.junit.Before
public void setUp() {
BusFactory.setThreadDefaultBus(getStaticBus());
BusFactory.getThreadDefaultBus().getOutInterceptors().add(new LoggingOutInterceptor());
BusFactory.getThreadDefaultBus().getInInterceptors().add(new LoggingInInterceptor());
BusFactory.getThreadDefaultBus().getInInterceptors().add(new MalformedResponseInterceptor());
}
代码示例来源:origin: apache/cxf
protected static PhaseInterceptorChain setupInInterceptorChain(ClientConfiguration cfg) {
PhaseManager pm = cfg.getBus().getExtension(PhaseManager.class);
List<Interceptor<? extends Message>> i1 = cfg.getBus().getInInterceptors();
List<Interceptor<? extends Message>> i2 = cfg.getInInterceptors();
List<Interceptor<? extends Message>> i3 = cfg.getConduitSelector().getEndpoint().getInInterceptors();
PhaseInterceptorChain chain = new PhaseChainCache().get(pm.getInPhases(), i1, i2, i3);
chain.add(new ClientResponseFilterInterceptor());
return chain;
}
代码示例来源:origin: org.apache.cxf/cxf-rt-ws-policy
public synchronized void removeBusInterceptors() {
bus.getInInterceptors().remove(PolicyInInterceptor.INSTANCE);
bus.getOutInterceptors().remove(PolicyOutInterceptor.INSTANCE);
bus.getInFaultInterceptors().remove(ClientPolicyInFaultInterceptor.INSTANCE);
bus.getOutFaultInterceptors().remove(ServerPolicyOutFaultInterceptor.INSTANCE);
bus.getInFaultInterceptors().remove(PolicyVerificationInFaultInterceptor.INSTANCE);
addedBusInterceptors = false;
}
代码示例来源:origin: apache/cxf
void registerInterceptorsToBus() {
ResponseTimeMessageInInterceptor in = new ResponseTimeMessageInInterceptor();
ResponseTimeMessageInvokerInterceptor invoker = new ResponseTimeMessageInvokerInterceptor();
ResponseTimeMessageOutInterceptor out = new ResponseTimeMessageOutInterceptor();
bus.getInInterceptors().add(in);
bus.getInInterceptors().add(invoker);
bus.getOutInterceptors().add(out);
bus.getOutFaultInterceptors().add(out);
bus.setExtension(this, CounterRepository.class);
//create CounterRepositroyMoniter to writer the counter log
//if the service is stopped or removed, the counters should remove itself
}
代码示例来源:origin: apache/cxf
/**
* @param b Bus to encapsulate
*/
public final void setBus(Bus b) {
bus = b;
if (bus != null) {
bus.setExtension(this, EndpointResolverRegistry.class);
}
}
代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http
public FormattedServiceListWriter(String styleSheetPath,
String title,
boolean showForeignContexts,
Bus bus) {
this.styleSheetPath = styleSheetPath;
this.title = title;
this.showForeignContexts = showForeignContexts;
this.bus = bus;
if (this.bus != null) {
this.atomMap =
CastUtils.cast((Map<?, ?>)this.bus.getProperty("org.apache.cxf.extensions.logging.atom.pull"));
}
}
代码示例来源:origin: apache/cxf
protected void run() {
Bus bus = BusFactory.getDefaultBus();
setBus(bus);
Map<String, Object> inProperties = new HashMap<>();
inProperties.put(ConfigurationConstants.ACTION, ConfigurationConstants.SAML_TOKEN_SIGNED);
inProperties.put(ConfigurationConstants.PW_CALLBACK_REF, new KeystorePasswordCallback());
inProperties.put(ConfigurationConstants.SIG_VER_PROP_FILE, "bob.properties");
WSS4JInInterceptor inInterceptor = new WSS4JInInterceptor(inProperties);
bus.getInInterceptors().add(inInterceptor);
broker.updateWsdl(bus, "testutils/jms_test.wsdl");
Endpoint.publish(null, new SecurityGreeterImplTwoWayJMS());
}
内容来源于网络,如有侵权,请联系作者删除!