本文整理汇总了Java中org.apache.cxf.common.logging.Slf4jLogger类的典型用法代码示例。如果您正苦于以下问题:Java Slf4jLogger类的具体用法?Java Slf4jLogger怎么用?Java Slf4jLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Slf4jLogger类属于org.apache.cxf.common.logging包,在下文中一共展示了Slf4jLogger类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createService
import org.apache.cxf.common.logging.Slf4jLogger; //导入依赖的package包/类
private <T> T createService(final Class<T> clazz,
final QName service,
final QName portName,
final String address,
final String userName,
final String password,
final String connectionTimeout,
final String readTimeout) {
Preconditions.checkNotNull(service, "service");
Preconditions.checkNotNull(portName, "portName");
Preconditions.checkNotNull(address, "address");
Preconditions.checkNotNull(userName, "username");
Preconditions.checkNotNull(password, "password");
// Delegate logging to slf4j (see also https://github.com/killbill/killbill-platform/tree/master/osgi-bundles/libs/slf4j-osgi)
LogUtils.setLoggerClass(Slf4jLogger.class);
final Service result = Service.create(null, service);
result.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);
final T port = result.getPort(portName, clazz);
final Client client = ClientProxy.getClient(port);
client.getEndpoint().put("jaxb-validation-event-handler", new IgnoreUnexpectedElementsEventHandler());
final HTTPConduit conduit = (HTTPConduit) client.getConduit();
final HTTPClientPolicy clientPolicy = conduit.getClient();
clientPolicy.setAllowChunking(config.getAllowChunking());
if (config.getTrustAllCertificates()) {
final TLSClientParameters tcp = new TLSClientParameters();
tcp.setTrustManagers(new TrustManager[]{new TrustAllX509TrustManager()});
conduit.setTlsClientParameters(tcp);
}
if (connectionTimeout != null) {
clientPolicy.setConnectionTimeout(Long.valueOf(connectionTimeout));
}
if (readTimeout != null) {
clientPolicy.setReceiveTimeout(Long.valueOf(readTimeout));
}
if (config.getProxyServer() != null) {
clientPolicy.setProxyServer(config.getProxyServer());
}
if (config.getProxyPort() != null) {
clientPolicy.setProxyServerPort(config.getProxyPort());
}
if (config.getProxyType() != null) {
clientPolicy.setProxyServerType(ProxyServerType.fromValue(config.getProxyType().toUpperCase()));
}
((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, userName);
((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
final Endpoint endpoint = client.getEndpoint();
endpoint.getInInterceptors().add(loggingInInterceptor);
endpoint.getOutInterceptors().add(loggingOutInterceptor);
endpoint.getOutInterceptors().add(httpHeaderInterceptor);
return port;
}