当前位置: 首页>>代码示例>>Java>>正文


Java LoggingInInterceptor类代码示例

本文整理汇总了Java中org.apache.cxf.interceptor.LoggingInInterceptor的典型用法代码示例。如果您正苦于以下问题:Java LoggingInInterceptor类的具体用法?Java LoggingInInterceptor怎么用?Java LoggingInInterceptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LoggingInInterceptor类属于org.apache.cxf.interceptor包,在下文中一共展示了LoggingInInterceptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRoutes

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
@Test
public void testRoutes() throws Exception {
    URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
    PersonService ss = new PersonService(wsdlURL, QName.valueOf(getServiceName()));

    Person client = ss.getSoap();
    
    Client c = ClientProxy.getClient(client);
    
    ((BindingProvider)client).getRequestContext()
        .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
             "http://localhost:" + port1 + "/" + getClass().getSimpleName() + "/PersonService");
    c.getInInterceptors().add(new LoggingInInterceptor());
    c.getOutInterceptors().add(new LoggingOutInterceptor());
    
    Holder<String> personId = new Holder<String>();
    personId.value = "hello";
    Holder<String> ssn = new Holder<String>();
    Holder<String> name = new Holder<String>();
    client.getPerson(personId, ssn, name);
    assertEquals("Bonjour", name.value);

}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:CXFWsdlOnlyPayloadModeNoSpringTest.java

示例2: testBusInjectedBySpring

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
@Test
public void testBusInjectedBySpring() throws Exception {
    CamelContext camelContext = ctx.getBean("camel", CamelContext.class);
    CxfEndpoint endpoint = camelContext.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);

    // verify the interceptor that is added by the logging feature
    // Spring 3.0.0 has an issue of SPR-6589 which will call the BusApplicationListener twice for the same event,
    // so we will get more one InInterceptors here
    assertTrue(endpoint.getBus().getInInterceptors().size() >= 1);
    for (Interceptor<?> i : endpoint.getBus().getInInterceptors()) {
        if (i instanceof LoggingInInterceptor) {
            return;
        }
    }
    fail("Could not find the LoggingInInterceptor on the bus. " + endpoint.getBus().getInInterceptors());
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:CxfEndpointBeanWithBusTest.java

示例3: testWsdlGeneration

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
/**
    * Tests WSDL generation from a URL.
    *
    * This is similar to another KEW test but it is good to have it as part of the KSB tests.  Note that the
    * {@link Client} modifies the current thread's class loader.
    *
    * @throws Exception for any errors connecting to the client
    */
@Test
public void testWsdlGeneration() throws Exception {
	ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();

       try {
           JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
           Client client = dcf.createClient(new URI(getWsdlUrl()).toString());
           client.getInInterceptors().add(new LoggingInInterceptor());
           client.getOutInterceptors().add(new LoggingOutInterceptor());
           Object[] results = client.invoke("echo", "testing");
           assertNotNull(results);
           assertEquals(1, results.length);
           assertEquals("testing", results[0]);
       } finally {
           Thread.currentThread().setContextClassLoader(originalClassLoader);
       }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:SOAPServiceTest.java

示例4: internalTestInfosetUsingFeatureProperties

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
private void internalTestInfosetUsingFeatureProperties(URL wsdlURL, QName serviceName, QName portQName) throws Exception {
   ByteArrayOutputStream out = new ByteArrayOutputStream();
   ByteArrayOutputStream in = new ByteArrayOutputStream();
   PrintWriter pwIn = new PrintWriter(in);
   PrintWriter pwOut = new PrintWriter(out);
   Bus bus = BusFactory.newInstance().createBus();
   BusFactory.setThreadDefaultBus(bus);
   try {
      bus.getInInterceptors().add(new LoggingInInterceptor(pwIn));
      bus.getOutInterceptors().add(new LoggingOutInterceptor(pwOut));

      Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
      HelloWorld port = (HelloWorld) service.getPort(portQName, HelloWorld.class);
      
      ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
      configurer.setConfigProperties(port, "META-INF/jaxws-client-config.xml", "Custom Client Config");
      
      assertEquals("helloworld", port.echo("helloworld"));
      assertTrue("request is expected fastinfoset", out.toString().indexOf("application/fastinfoset") > -1);
      assertTrue("response is expected fastinfoset", in.toString().indexOf("application/fastinfoset") > -1);
   } finally {
      bus.shutdown(true);
      pwOut.close();
      pwIn.close();
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:27,代码来源:FastInfosetTestCase.java

示例5: createClientProxy

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
private static HelloWorldPortType createClientProxy() {
    JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();

    // create the loggingInInterceptor and loggingOutInterceptor
    LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
    loggingInInterceptor.setPrettyLogging(true);
    LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
    loggingOutInterceptor.setPrettyLogging(true);

    // add loggingInterceptor to print the received/sent messages
    jaxWsProxyFactoryBean.getInInterceptors().add(loggingInInterceptor);
    jaxWsProxyFactoryBean.getInFaultInterceptors()
            .add(loggingInInterceptor);
    jaxWsProxyFactoryBean.getOutInterceptors().add(loggingOutInterceptor);
    jaxWsProxyFactoryBean.getOutFaultInterceptors()
            .add(loggingOutInterceptor);

    jaxWsProxyFactoryBean.setServiceClass(HelloWorldPortType.class);
    jaxWsProxyFactoryBean.setAddress(ENDPOINT_ADDRESS);

    return (HelloWorldPortType) jaxWsProxyFactoryBean.create();
}
 
开发者ID:code-not-found,项目名称:jaxws-cxf,代码行数:23,代码来源:HelloWorldImplTest.java

示例6: userServiceEndpoint

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
@Bean(name = "helloEndpoint")
public CxfEndpoint userServiceEndpoint() {
    CxfEndpoint cxfEndpoint = new CxfEndpoint();
    cxfEndpoint.setAddress("http://localhost:8888/services/hello");
    cxfEndpoint.setServiceClass(HelloWorld.class);
    LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
    loggingInInterceptor.setPrettyLogging(true);
    LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
    loggingOutInterceptor.setPrettyLogging(true);
    cxfEndpoint.getOutInterceptors().add(loggingOutInterceptor);
    cxfEndpoint.getInInterceptors().add(loggingInInterceptor);
    cxfEndpoint.setDataFormat(DataFormat.POJO);
    final Map<String, Object> properties = new HashMap<>();
    properties.put("schema-validation-enabled", "true");
    properties.put("bus.jmx.enabled", "true");

    //properties.setProperty("faultStackTraceEnabled", "true");
    //properties.setProperty("exceptionMessageCauseEnabled", "true");
    //properties.setProperty("schema-validation-enabled", "false");

    //properties.put("allowStreaming", true);
    cxfEndpoint.configureProperties(properties);
    return cxfEndpoint;
}
 
开发者ID:przodownikR1,项目名称:cxf_over_jms_kata,代码行数:25,代码来源:CamelConfig.java

示例7: start

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
public T start(Class<T> cls, String url, boolean trustAllCerts, String trustStore, String trustStorePassword, 
	List<?> providers, int connectTimeout, int receiveTimeout) {

	try {
		
		T resource = JAXRSClientFactory.create(url, cls, providers);
	    HTTPConduit conduit = WebClient.getConfig(resource).getHttpConduit();
	    WebClient.getConfig(resource).getInInterceptors().add(new LoggingInInterceptor());
	    WebClient.getConfig(resource).getOutInterceptors().add(new LoggingOutInterceptor());
		configureHTTPS(resource, conduit, trustAllCerts, trustStore, trustStorePassword);
		
	    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); 
	    httpClientPolicy.setConnectionTimeout(connectTimeout); 
	    httpClientPolicy.setReceiveTimeout(receiveTimeout); 
	    conduit.setClient(httpClientPolicy);
		
		return resource;
		
	} catch (Exception e) {
		LOG.error(" rest client '{}': NOT STARTED", url);
		return null;
	}
	
}
 
开发者ID:csob,项目名称:paymentgateway,代码行数:25,代码来源:JaxRsClientStarter.java

示例8: createLocalJaxWsService

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
/**
	 * 构造服务,注意要自己释放
	 * @param intf
	 * @param bean
	 * @return
	 */
	private Server createLocalJaxWsService(Class<?> intf, Object bean) {
		String url = "local://" + intf.getName();
		ServiceDefinition ws = getFactory().processServiceDef(new ServiceDefinition(intf.getSimpleName(),intf,bean));
		if (ws == null)
			return null;
		JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean(new CXFPlusServiceFactoryBean());
		sf.setAddress(url);
		sf.setServiceBean(ws.getServiceBean());
		sf.setServiceClass(ws.getServiceClass());
		if (printTrace()){
			sf.getInInterceptors().add(new LoggingInInterceptor());
			sf.getOutInterceptors().add(new LoggingOutInterceptor());
//			sf.getHandlers().add(TraceHandler.getSingleton());
		}
		Server server = sf.create();
		return server;
	}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:24,代码来源:CXFTestBase.java

示例9: createLocalService

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的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;
}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:23,代码来源:CXFTestBase.java

示例10: rawTest

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
@Test
	@Ignore
	public void rawTest(){
		JAXRSClientFactoryBean bean=new JAXRSClientFactoryBean();
		bean.setAddress("http://localhost:8080/cxf-plus/ws/rest/");
		                 
		bean.setServiceClass(PeopleServiceXml.class);
//		bean.setProvider(new FastJSONProvider(true, false));
		
		bean.getInInterceptors().add(new LoggingInInterceptor());
		bean.getOutInterceptors().add(new LoggingOutInterceptor());
		
		PeopleServiceXml s=(PeopleServiceXml)bean.create();
		List<People> r=s.getAll();
		
		System.out.println("-------------------");
		System.out.println("得到用户"+r.size());
//		int id=s.create(new People("[email protected]","jiyi","lu"));
//		System.out.println(id);
	}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:21,代码来源:ClientTest.java

示例11: testCallAxis2

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
@Test
	@Ignore
	public void testCallAxis2(){
		
		//服务位于: http://localhost/axis2-web/services/myService?wsdl
		
//		JaxWsClientFactoryBean clientBean=new JaxWsClientFactoryBean();
//		JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
		
		ClientProxyFactoryBean factoryBean=new ClientProxyFactoryBean();
		factoryBean.setAddress("http://localhost/axis2-web/services/myService?wsdl");
		factoryBean.setServiceClass(MyService.class);   //有接口调用
		
		//修复兼容性:
		//发现居然提示命名空间不对,原来是CXF认为命名空间用/结尾,多一个斜杠引起问题
		factoryBean.setServiceName(new QName("http://sevice.test.axis2","MyService"));
		
		factoryBean.getInInterceptors().add(new LoggingInInterceptor());
		factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());
		MyService service=(MyService)factoryBean.create();
		
		System.out.println(service.getHello("将"));//当前类
		String result=service.toBaseString("Hello, jiyi", 100);//父类方法
		System.out.println(result);
	}
 
开发者ID:GeeQuery,项目名称:cxf-plus,代码行数:26,代码来源:CallAxis2.java

示例12: Publish

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
static void Publish()
{
    HelloWorldImpl implementor = new HelloWorldImpl();
    JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    System.setProperties(applyNoLimits(System.getProperties()));
    svrFactory.setServiceClass(HelloWorld.class);
    svrFactory.setAddress(Address);
    svrFactory.setServiceBean(implementor);

    TransferInterceptor.addServerHook(svrFactory, new MyServerHook());
    TransferInterceptor.addServerHook(svrFactory,new MyLogHook());

    svrFactory.getInInterceptors().add(new LoggingInInterceptor());
    svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    svrFactory.create();
    System.out.println("Published: " + implementor.getClass());
}
 
开发者ID:devizer,项目名称:jlab,代码行数:18,代码来源:ServerSide.java

示例13: Call

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
public static void Call()
{
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    TransferInterceptor.addClientHook(factory, new MyClientHook());

    factory.getInInterceptors().add(new LoggingInInterceptor());
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    factory.setServiceClass(HelloWorld.class);
    factory.setAddress(ServerSide.Address);
    HelloWorld client = (HelloWorld) factory.create();

    String reply = client.sayHi("Vlad");
    System.out.println("Server said: " + reply);

    String reply2 = client.sayHi(43);
    System.out.println("Server said: " + reply2);
    // System.exit(0);
}
 
开发者ID:devizer,项目名称:jlab,代码行数:19,代码来源:ClientSide.java

示例14: getGMESoapClient

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
private GlobalModelExchangePortType getGMESoapClient() throws GeneralSecurityException, IOException {
    KeyStoreType truststore = new KeyStoreType();
    truststore.setFile(TRUSTSTORE);
    truststore.setType(TRUSTSTORETYPE);
    truststore.setPassword(TRUSTSTOREPASSWORD);

    X509Credential credential = CredentialFactory.getCredential(
            HOST,
            KEYSTOREPASSWORD,
            KEYALIAS,
            KEYPASSWORD);

    KeyManager keyManager = new SingleEntityKeyManager(KEYALIAS, credential);

    GlobalModelExchangePortType gmePort = GMESoapClientFactory.createSoapClient(GME_URL, truststore, keyManager);
    Client client = ClientProxy.getClient(gmePort);
    client.getInInterceptors().add(new LoggingInInterceptor());
    client.getOutInterceptors().add(new LoggingOutInterceptor()); 
 
    return gmePort;
}
 
开发者ID:NCIP,项目名称:cagrid2,代码行数:22,代码来源:GMEFunctionalTest.java

示例15: addLoggers

import org.apache.cxf.interceptor.LoggingInInterceptor; //导入依赖的package包/类
@PostConstruct
private void addLoggers() {
	if (cxfDebug) {
		LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
		bus.getInInterceptors().add(loggingInInterceptor);
		bus.getInFaultInterceptors().add(loggingInInterceptor);

		LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
		bus.getOutInterceptors().add(loggingOutInterceptor);
		bus.getOutFaultInterceptors().add(loggingOutInterceptor);
	}
}
 
开发者ID:esig,项目名称:dss-demonstrations,代码行数:13,代码来源:CXFConfig.java


注:本文中的org.apache.cxf.interceptor.LoggingInInterceptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。