當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。