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


Java CxfEndpoint.getInInterceptors方法代码示例

本文整理汇总了Java中org.apache.camel.component.cxf.CxfEndpoint.getInInterceptors方法的典型用法代码示例。如果您正苦于以下问题:Java CxfEndpoint.getInInterceptors方法的具体用法?Java CxfEndpoint.getInInterceptors怎么用?Java CxfEndpoint.getInInterceptors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.component.cxf.CxfEndpoint的用法示例。


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

示例1: createCxfConsumerEndpoint

import org.apache.camel.component.cxf.CxfEndpoint; //导入方法依赖的package包/类
@Named("cxfConsumerEndpoint")
@Produces
public CxfEndpoint createCxfConsumerEndpoint() {
    CxfComponent cxfConsumerComponent = new CxfComponent(this.camelContext);
    CxfEndpoint cxfConsumerEndpoint = new CxfEndpoint(CXF_CONSUMER_ENDPOINT_ADDRESS, cxfConsumerComponent);
    cxfConsumerEndpoint.setBeanId("cxfConsumerEndpoint");
    cxfConsumerEndpoint.setServiceClass(org.wildfly.camel.examples.cxf.jaxws.GreetingService.class);

    SSLContextParameters consumerSslContextParameters = this.createConsumerSSLContextParameters();
    cxfConsumerEndpoint.setSslContextParameters(consumerSslContextParameters);

    List<Interceptor<? extends Message>> inInterceptors = cxfConsumerEndpoint.getInInterceptors();

    // Authentication
    JAASLoginInterceptor jaasLoginInterceptor = new JAASLoginInterceptor();
    jaasLoginInterceptor.setContextName(WILDFLY_SECURITY_DOMAIN_NAME);
    jaasLoginInterceptor.setAllowAnonymous(false);
    List<CallbackHandlerProvider> chp = Arrays.asList(new JBossCallbackHandlerTlsCert());
    jaasLoginInterceptor.setCallbackHandlerProviders(chp);
    inInterceptors.add(jaasLoginInterceptor);

    // Authorization
    SimpleAuthorizingInterceptor authorizingInterceptor = new SimpleAuthorizingInterceptor();
    authorizingInterceptor.setAllowAnonymousUsers(false);
    Map<String, String> rolesMap = new HashMap<>(1);
    rolesMap.put("greet", "testRole");
    authorizingInterceptor.setMethodRolesMap(rolesMap);
    inInterceptors.add(authorizingInterceptor);
    return cxfConsumerEndpoint;
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel-examples,代码行数:31,代码来源:Application.java

示例2: configureCamelContext

import org.apache.camel.component.cxf.CxfEndpoint; //导入方法依赖的package包/类
private CamelContext configureCamelContext(String password) throws Exception {
    CamelContext camelctx = new DefaultCamelContext();

    CxfComponent component = new CxfComponent(camelctx);
    CxfEndpoint consumerEndpoint = new CxfEndpoint("http://localhost:8080/webservices/greeting", component);
    consumerEndpoint.setServiceClass(Endpoint.class);

    List<Interceptor<? extends Message>> inInterceptors = consumerEndpoint.getInInterceptors();
    JAASLoginInterceptor interceptor =  new JAASLoginInterceptor();
    interceptor.setContextName("other");
    inInterceptors.add(interceptor);

    CxfEndpoint producerEndpoint = new CxfEndpoint("http://localhost:8080/webservices/greeting", component);
    producerEndpoint.setServiceClass(Endpoint.class);
    producerEndpoint.setUsername("user1");
    producerEndpoint.setPassword(password);

    Map<String, Object> properties = producerEndpoint.getProperties();
    if (properties == null) {
        producerEndpoint.setProperties(new HashMap<>());
    }

    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
            .to(producerEndpoint);

            from(consumerEndpoint)
            .process(exchange -> {
                Object[] args = exchange.getIn().getBody(Object[].class);
                exchange.getOut().setBody("Hello " + args[0]);
            });
        }
    });
    return camelctx;
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:38,代码来源:CXFWSJAASAuthenticationIntegrationTest.java

示例3: testCXFInterceptor

import org.apache.camel.component.cxf.CxfEndpoint; //导入方法依赖的package包/类
@Test
public void testCXFInterceptor() throws Exception {
    CountDownLatch latch = new CountDownLatch(1);

    CamelContext camelctx = new DefaultCamelContext();

    CxfComponent component = new CxfComponent(camelctx);
    CxfEndpoint cxfEndpoint = new CxfEndpoint("http://localhost:8080/EndpointService/EndpointPort", component);
    cxfEndpoint.setServiceClass(Endpoint.class);

    List<Interceptor<? extends Message>> inInterceptors = cxfEndpoint.getInInterceptors();
    inInterceptors.add(new CountDownInterceptor(latch));

    camelctx.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from(cxfEndpoint)
            .setBody(constant("Hello ${body}"));
        }
    });

    camelctx.start();
    try {
        QName qname = new QName("http://wildfly.camel.test.cxf", "EndpointService");
        Service service = Service.create(new URL("http://localhost:8080/EndpointService/EndpointPort?wsdl"), qname);
        Endpoint endpoint = service.getPort(Endpoint.class);
        endpoint.echo("Kermit");
        Assert.assertTrue("Gave up waiting for CXF interceptor handleMessage", latch.await(5, TimeUnit.SECONDS));
    } finally {
        camelctx.stop();
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:33,代码来源:CXFWSInterceptorTest.java


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