Search in sources :

Example 26 with LoggingInInterceptor

use of org.apache.cxf.interceptor.LoggingInInterceptor in project qi4j-sdk by Qi4j.

the class HelloMain method main.

public static void main(String[] args) {
    HelloWorldImpl implementor = new HelloWorldImpl();
    JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    svrFactory.setServiceClass(HelloWorld.class);
    svrFactory.setAddress("http://localhost:9001/helloWorld");
    svrFactory.setServiceBean(implementor);
    svrFactory.getInInterceptors().add(new LoggingInInterceptor());
    svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    svrFactory.create();
}
Also used : LoggingOutInterceptor(org.apache.cxf.interceptor.LoggingOutInterceptor) LoggingInInterceptor(org.apache.cxf.interceptor.LoggingInInterceptor) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 27 with LoggingInInterceptor

use of org.apache.cxf.interceptor.LoggingInInterceptor in project maven-plugins by apache.

the class RestJiraDownloader method setupWebClient.

private WebClient setupWebClient(String jiraUrl) {
    WebClient client = WebClient.create(jiraUrl);
    ClientConfiguration clientConfiguration = WebClient.getConfig(client);
    HTTPConduit http = clientConfiguration.getHttpConduit();
    // MCHANGES-324 - Maintain the client session
    clientConfiguration.getRequestContext().put(Message.MAINTAIN_SESSION, Boolean.TRUE);
    if (getLog().isDebugEnabled()) {
        clientConfiguration.getInInterceptors().add(new LoggingInInterceptor());
        clientConfiguration.getOutInterceptors().add(new LoggingOutInterceptor());
    }
    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    // MCHANGES-341 Externalize JIRA server timeout values to the configuration section
    getLog().debug("RestJiraDownloader: connectionTimeout: " + connectionTimeout);
    httpClientPolicy.setConnectionTimeout(connectionTimeout);
    httpClientPolicy.setAllowChunking(false);
    getLog().debug("RestJiraDownloader: receiveTimout: " + receiveTimout);
    httpClientPolicy.setReceiveTimeout(receiveTimout);
    // MCHANGES-334 RestJiraDownloader doesn't honor proxy settings
    getProxyInfo(jiraUrl);
    if (proxyHost != null) {
        getLog().debug("Using proxy: " + proxyHost + " at port " + proxyPort);
        httpClientPolicy.setProxyServer(proxyHost);
        httpClientPolicy.setProxyServerPort(proxyPort);
        httpClientPolicy.setProxyServerType(ProxyServerType.HTTP);
        if (proxyUser != null) {
            ProxyAuthorizationPolicy proxyAuthorizationPolicy = new ProxyAuthorizationPolicy();
            proxyAuthorizationPolicy.setAuthorizationType("Basic");
            proxyAuthorizationPolicy.setUserName(proxyUser);
            proxyAuthorizationPolicy.setPassword(proxyPass);
            http.setProxyAuthorization(proxyAuthorizationPolicy);
        }
    }
    if (webUser != null) {
        AuthorizationPolicy authPolicy = new AuthorizationPolicy();
        authPolicy.setAuthorizationType("Basic");
        authPolicy.setUserName(webUser);
        authPolicy.setPassword(webPassword);
        http.setAuthorization(authPolicy);
    }
    http.setClient(httpClientPolicy);
    return client;
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) ProxyAuthorizationPolicy(org.apache.cxf.configuration.security.ProxyAuthorizationPolicy) AuthorizationPolicy(org.apache.cxf.configuration.security.AuthorizationPolicy) LoggingOutInterceptor(org.apache.cxf.interceptor.LoggingOutInterceptor) ProxyAuthorizationPolicy(org.apache.cxf.configuration.security.ProxyAuthorizationPolicy) HTTPClientPolicy(org.apache.cxf.transports.http.configuration.HTTPClientPolicy) LoggingInInterceptor(org.apache.cxf.interceptor.LoggingInInterceptor) WebClient(org.apache.cxf.jaxrs.client.WebClient) ClientConfiguration(org.apache.cxf.jaxrs.client.ClientConfiguration)

Example 28 with LoggingInInterceptor

use of org.apache.cxf.interceptor.LoggingInInterceptor in project tesb-rt-se by Talend.

the class StsConfigurator method removeMessageLogging.

private void removeMessageLogging(Bus bus) {
    Collection<Feature> features = bus.getFeatures();
    Feature logFeature = null;
    Interceptor inLogInterceptor = null;
    Interceptor outLogInterceptor = null;
    for (Feature feature : features) {
        if (feature instanceof LoggingFeature) {
            logFeature = feature;
            break;
        }
    }
    if (logFeature != null) {
        features.remove(logFeature);
    }
    for (Interceptor interceptor : bus.getInInterceptors()) {
        if (interceptor instanceof LoggingInInterceptor) {
            inLogInterceptor = interceptor;
            break;
        }
    }
    for (Interceptor interceptor : bus.getOutInterceptors()) {
        if (interceptor instanceof LoggingOutInterceptor) {
            outLogInterceptor = interceptor;
            break;
        }
    }
    if (inLogInterceptor != null) {
        bus.getInInterceptors().remove(inLogInterceptor);
    // System.out.println("\nRemove in Interceptor = " + inLogInterceptor.getClass().getName());
    }
    if (outLogInterceptor != null) {
        bus.getOutInterceptors().remove(outLogInterceptor);
    // System.out.println("\nRemove out Interceptor = " + inLogInterceptor.getClass().getName());
    }
}
Also used : LoggingOutInterceptor(org.apache.cxf.interceptor.LoggingOutInterceptor) LoggingFeature(org.apache.cxf.feature.LoggingFeature) LoggingInInterceptor(org.apache.cxf.interceptor.LoggingInInterceptor) LoggingFeature(org.apache.cxf.feature.LoggingFeature) Feature(org.apache.cxf.feature.Feature) LoggingInInterceptor(org.apache.cxf.interceptor.LoggingInInterceptor) Interceptor(org.apache.cxf.interceptor.Interceptor) LoggingOutInterceptor(org.apache.cxf.interceptor.LoggingOutInterceptor)

Example 29 with LoggingInInterceptor

use of org.apache.cxf.interceptor.LoggingInInterceptor in project tesb-rt-se by Talend.

the class StsConfiguratorTest method getBus.

private Bus getBus() {
    Collection<Feature> features = new ArrayList<Feature>();
    features.add(new LoggingFeature());
    List<Interceptor<? extends Message>> inInterceptors = new ArrayList<Interceptor<? extends Message>>();
    inInterceptors.add(new LoggingInInterceptor());
    List<Interceptor<? extends Message>> inFaultInterceptors = new ArrayList<Interceptor<? extends Message>>();
    inFaultInterceptors.add(new LoggingInInterceptor());
    List<Interceptor<? extends Message>> outInterceptors = new ArrayList<Interceptor<? extends Message>>();
    outInterceptors.add(new LoggingOutInterceptor());
    List<Interceptor<? extends Message>> outFaultInterceptors = new ArrayList<Interceptor<? extends Message>>();
    outFaultInterceptors.add(new LoggingOutInterceptor());
    Bus bus = createMock(Bus.class);
    expect(bus.getFeatures()).andReturn(features).anyTimes();
    expect(bus.getInInterceptors()).andReturn(inInterceptors).anyTimes();
    expect(bus.getOutInterceptors()).andReturn(outInterceptors).anyTimes();
    expect(bus.getInFaultInterceptors()).andReturn(inFaultInterceptors).anyTimes();
    expect(bus.getOutFaultInterceptors()).andReturn(outFaultInterceptors).anyTimes();
    replay(bus);
    return bus;
}
Also used : Bus(org.apache.cxf.Bus) Message(org.apache.cxf.message.Message) LoggingOutInterceptor(org.apache.cxf.interceptor.LoggingOutInterceptor) LoggingFeature(org.apache.cxf.feature.LoggingFeature) ArrayList(java.util.ArrayList) LoggingInInterceptor(org.apache.cxf.interceptor.LoggingInInterceptor) Feature(org.apache.cxf.feature.Feature) LoggingFeature(org.apache.cxf.feature.LoggingFeature) Interceptor(org.apache.cxf.interceptor.Interceptor) LoggingOutInterceptor(org.apache.cxf.interceptor.LoggingOutInterceptor) LoggingInInterceptor(org.apache.cxf.interceptor.LoggingInInterceptor)

Aggregations

LoggingInInterceptor (org.apache.cxf.interceptor.LoggingInInterceptor)29 LoggingOutInterceptor (org.apache.cxf.interceptor.LoggingOutInterceptor)25 Test (org.junit.Test)12 URL (java.net.URL)9 Bus (org.apache.cxf.Bus)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 PrintWriter (java.io.PrintWriter)6 Service (javax.xml.ws.Service)6 Client (org.apache.cxf.endpoint.Client)6 UseThreadBusFeature (org.jboss.wsf.stack.cxf.client.UseThreadBusFeature)6 QName (javax.xml.namespace.QName)5 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)5 JBossWSTest (org.jboss.wsf.test.JBossWSTest)5 BindingProvider (javax.xml.ws.BindingProvider)4 Holder (javax.xml.ws.Holder)4 Person (org.apache.camel.wsdl_first.Person)4 PersonService (org.apache.camel.wsdl_first.PersonService)4 WSS4JOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor)4 ModelPortType (com.evolveum.midpoint.xml.ns._public.model.model_3.ModelPortType)3 ModelService (com.evolveum.midpoint.xml.ns._public.model.model_3.ModelService)3