本文整理汇总了Java中org.apache.cxf.feature.LoggingFeature类的典型用法代码示例。如果您正苦于以下问题:Java LoggingFeature类的具体用法?Java LoggingFeature怎么用?Java LoggingFeature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LoggingFeature类属于org.apache.cxf.feature包,在下文中一共展示了LoggingFeature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpBeforeClass
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
// start the HelloWorld service using jaxWsServerFactoryBean
JaxWsServerFactoryBean jaxWsServerFactoryBean =
new JaxWsServerFactoryBean();
// adding loggingFeature to print the received/sent messages
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
jaxWsServerFactoryBean.getFeatures().add(loggingFeature);
// setting the implementation
HelloWorldImpl implementor = new HelloWorldImpl();
jaxWsServerFactoryBean.setServiceBean(implementor);
// setting the endpoint
jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);
jaxWsServerFactoryBean.create();
}
示例2: createLoggingFeature
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
/**
*
* @return
* @task https://metasfresh.atlassian.net/browse/FRESH-87
*/
@Bean
public LoggingFeature createLoggingFeature()
{
final boolean prettyPrint = true;
final boolean showBinary = true;
// see LoggingFeature.initializeProvider()...we want to make sure that showBinary is not ignored
final int limit = AbstractLoggingInterceptor.DEFAULT_LIMIT + 1;
final LoggingFeature loggingFeature = new LoggingFeature(
null, // use default
null, // use default
limit,
prettyPrint,
showBinary);
return loggingFeature;
}
示例3: getSingletons
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
@Override
public Set<Object> getSingletons() {
Swagger2Feature swagger = new Swagger2Feature();
swagger.setBasePath("/");
swagger.setHost("localhost:9000");
swagger.setTitle("Order Service");
swagger.setDescription("Rider Auto Parts Order Service");
swagger.setVersion("2.0.0");
swagger.setContact("[email protected]");
swagger.setPrettyPrint(true);
Set<Object> answer = new HashSet<>();
answer.add(orderService);
answer.add(new JacksonJsonProvider());
answer.add(swagger);
// to turn on verbose logging
answer.add(new LoggingFeature());
return answer;
}
示例4: createServerEndpoint
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
private static void createServerEndpoint() {
JaxWsServerFactoryBean jaxWsServerFactoryBean =
new JaxWsServerFactoryBean();
// create the loggingFeature
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
// add the loggingFeature to print the received/sent messages
jaxWsServerFactoryBean.getFeatures().add(loggingFeature);
HelloWorldImpl implementor = new HelloWorldImpl();
jaxWsServerFactoryBean.setServiceBean(implementor);
jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);
jaxWsServerFactoryBean.create();
}
示例5: activate
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
@Activate
public void activate() {
Client client = ClientBuilder.newBuilder()
.register(BraveTracingFeature.create(brave))
.register(new LoggingFeature())
.build();
try {
brave.localTracer().startNewSpan("TraceMain", "activate");
for (int c = 0; c < 3; c++) {
try {
System.out.println("Read simple resource");
client.target("http://localhost:8181/cxf/simple").request().async().get(String.class);
} catch (Exception e) {
e.printStackTrace();
}
}
} finally {
brave.localTracer().finishSpan();
}
}
示例6: createLoggingFeature
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
/**
*
* @return
* @task https://metasfresh.atlassian.net/browse/FRESH-87
*/
@Bean
public LoggingFeature createLoggingFeature()
{
final boolean prettyPrint = true;
final boolean showBinary = true;
// see LoggingFeature.initializeProvider()...we want to make sure that showBinary is not ignored
final int limit = AbstractLoggingInterceptor.DEFAULT_LIMIT + 1;
final LoggingFeature loggingFeature = new LoggingFeature(
null, // use default
null, // use default
limit,
prettyPrint,
showBinary);
return loggingFeature;
}
示例7: setUpBeforeClass
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
// start the HelloWorld service using jaxWsServerFactoryBean
JaxWsServerFactoryBean jaxWsServerFactoryBean = new JaxWsServerFactoryBean();
// adding loggingFeature to print the received/sent messages
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
jaxWsServerFactoryBean.getFeatures().add(loggingFeature);
// setting the implementation
HelloWorldImpl implementor = new HelloWorldImpl();
jaxWsServerFactoryBean.setServiceBean(implementor);
// setting the endpoint
jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);
jaxWsServerFactoryBean.create();
}
示例8: setUpBeforeClass
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
Properties properties = System.getProperties();
// set the 'java.security.auth.login.config' property with the location
// of the JAAS login configuration
properties.setProperty("java.security.auth.login.config",
"./src/test/resources/jaas-login.conf");
JaxWsServerFactoryBean jaxWsServerFactoryBean = new JaxWsServerFactoryBean();
jaxWsServerFactoryBean.setServiceBean(new HelloWorldEndpointImpl());
jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
jaxWsServerFactoryBean.getFeatures().add(loggingFeature);
// create a JAASLoginInterceptor to enable authentication
JAASLoginInterceptor jaasLoginInterceptor = new JAASLoginInterceptor();
// set the context to lookup from 'java.security.auth.login.config'
jaasLoginInterceptor.setContextName("jaasContext");
// add the JAASLoginInterceptor to the server
jaxWsServerFactoryBean.getInInterceptors().add(jaasLoginInterceptor);
jaxWsServerFactoryBean.create();
}
示例9: createServerEndpoint
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
private static void createServerEndpoint() {
JaxWsServerFactoryBean jaxWsServerFactoryBean = new JaxWsServerFactoryBean();
// create the loggingFeature
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
// adding loggingFeature to print the received/sent messages
jaxWsServerFactoryBean.getFeatures().add(loggingFeature);
HelloWorldImpl implementor = new HelloWorldImpl();
jaxWsServerFactoryBean.setServiceBean(implementor);
jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);
jaxWsServerFactoryBean.create();
}
示例10: createServerEndpoint
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
private static void createServerEndpoint() {
JaxWsServerFactoryBean jaxWsServerFactoryBean = new JaxWsServerFactoryBean();
// create the loggingFeature
LoggingFeature loggingFeature = new LoggingFeature();
loggingFeature.setPrettyLogging(true);
// add the loggingFeature to print the received/sent messages
jaxWsServerFactoryBean.getFeatures().add(loggingFeature);
HelloWorldImpl implementor = new HelloWorldImpl();
jaxWsServerFactoryBean.setServiceBean(implementor);
jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);
jaxWsServerFactoryBean.create();
}
示例11: build
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
/**
* Build a client proxy, for a specific proxy type.
*
* @param proxyType proxy type class
* @return client proxy stub
*/
protected <T> T build(Class<T> proxyType) {
String address = generateAddress();
T rootResource;
// Synchronized on the class to correlate with the scope of clientStaticResources
// We want to ensure that the shared bean isn't set concurrently in multiple callers
synchronized (AmbariClientBuilder.class) {
JAXRSClientFactoryBean bean = cleanFactory(clientStaticResources.getUnchecked(proxyType));
bean.setAddress(address);
if (username != null) {
bean.setUsername(username);
bean.setPassword(password);
}
if (enableLogging) {
bean.setFeatures(Arrays.<AbstractFeature> asList(new LoggingFeature()));
}
rootResource = bean.create(proxyType);
}
boolean isTlsEnabled = address.startsWith("https://");
ClientConfiguration config = WebClient.getConfig(rootResource);
HTTPConduit conduit = (HTTPConduit) config.getConduit();
if (isTlsEnabled) {
TLSClientParameters tlsParams = new TLSClientParameters();
if (!validateCerts) {
tlsParams.setTrustManagers(new TrustManager[] { new AcceptAllTrustManager() });
} else if (trustManagers != null) {
tlsParams.setTrustManagers(trustManagers);
}
tlsParams.setDisableCNCheck(!validateCn);
conduit.setTlsClientParameters(tlsParams);
}
HTTPClientPolicy policy = conduit.getClient();
policy.setConnectionTimeout(connectionTimeoutUnits.toMillis(connectionTimeout));
policy.setReceiveTimeout(receiveTimeoutUnits.toMillis(receiveTimeout));
return rootResource;
}
示例12: getSingletons
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
@Override
public Set<Object> getSingletons() {
Set<Object> answer = new HashSet<Object>();
answer.add(apiMasterService);
answer.add(jacksonJsonProvider);
answer.add(new SwaggerFeature());
/*
TODO
answer.add();
answer.add(new EnableJMXFeature());
*/
if (cxfLogRequests) {
answer.add(new LoggingFeature());
}
return answer;
}
示例13: setup
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
@Before
public void setup() {
final Bus bus = CXFBusFactory.getThreadDefaultBus();
JaxWsServerFactoryBean jaxWsServer = createJaxWsServer();
jaxWsServer.getFeatures().add(new LoggingFeature());
jaxWsServer.getFeatures().add(new TraceeCxfFeature(serverBackend, Profile.DEFAULT));
server = jaxWsServer.create();
JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
factoryBean.setServiceClass(HelloWorldTestService.class);
factoryBean.setAddress(endpointAddress);
factoryBean.getHandlers().add(new TraceeClientHandler(clientBackend));
factoryBean.setBus(bus);
helloWorldPort = factoryBean.create(HelloWorldTestService.class);
}
示例14: rsServer
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
@Bean
public Server rsServer() {
JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
endpoint.setBus(bus);
endpoint.setAddress("/");
endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new ExceptionRestHandler()));
Map<Object, Object> mappings = new HashMap<Object, Object>();
mappings.put("json", "application/json");
endpoint.setExtensionMappings(mappings);
Swagger2Feature swagger2Feature = new Swagger2Feature();
swagger2Feature.setTitle(title);
swagger2Feature.setDescription(description);
swagger2Feature.setVersion(version);
swagger2Feature.setContact(contact);
swagger2Feature.setSchemes(schemes.split(","));
swagger2Feature.setBasePath(basePath);
swagger2Feature.setResourcePackage(resourcePackage);
swagger2Feature.setPrettyPrint(prettyPrint);
swagger2Feature.setScan(scan);
endpoint.setFeatures(Arrays.asList(new LoggingFeature(), swagger2Feature));
endpoint.setServiceBeans(Arrays.asList(tccCoordinatorService, compositeController));
return endpoint.create();
}
示例15: springBus
import org.apache.cxf.feature.LoggingFeature; //导入依赖的package包/类
/**
* Help by: http://stackoverflow.com/a/31988136
*
* logFeature.initialize(springBus) is not needed, because during the init of bus it will call f.initialize(this)
* in {@link org.apache.cxf.bus.extension.ExtensionManagerBus#initializeFeatures()} anyway
*/
@Bean(name = Bus.DEFAULT_BUS_ID, destroyMethod = "shutdown")
public SpringBus springBus() {
SpringBus bus = new SpringBus();
bus.getFeatures().add(new LoggingFeature()); // Log incoming/outgoing messages
return bus;
}