骆驼拦截器与CXF拦截器发生冲突

时间:2017-09-18 01:07:03

标签: apache-camel cxf

我正在使用自定义InterceptStrategy,它会在SOAP响应成功后抛出错误。

错误:java.lang.IllegalStateException:在调用complete()或调用任何dispatch()方法后调用getRequest()是非法的     at org.apache.catalina.core.AsyncContextImpl.getRequest(AsyncContextImpl.java:224)     在org.apache.catalina.core.AsyncContextImpl.dispatch(AsyncContextImpl.java:153)     在org.springframework.security.web.servletapi.HttpServlet3RequestFactory $ SecurityContextAsyncContext.dispatch(HttpServlet3RequestFactory.java:291)     at org.apache.cxf.transport.http.Servlet3ContinuationProvider $ Servlet3Continuation.redispatch(Servlet3ContinuationProvider.java:125)     在org.apache.cxf.transport.http.Servlet3ContinuationProvider $ Servlet3Continuation.resume(Servlet3ContinuationProvider.java:131)

public class ApplicationLogStrategy implements InterceptStrategy {

    @Override
    public Processor wrapProcessorInInterceptors(CamelContext context, ProcessorDefinition<?> definition,
            Processor target, Processor nextTarget) throws Exception {


            return new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {
                    System.out.println("Display" + definition);
                    if (definition.getId().equalsIgnoreCase(ApplicationConstants.INITIAL_LOG)) {
                        //setCommonFields(exchange);
                        //setSpecificFields(exchange);
                    }
                    target.process(exchange);

                }
            };

    }
}

我的骆驼路线:

 <camelContext id="id-por" xmlns="http://camel.apache.org/schema/spring">
    <route>
      <!-- route starts from the cxf webservice -->
      <from uri="cxf:bean:porEndpoint" />
      <doTry>
        <to uri="bean:soapBean?method=processSOAP"/>
        <bean id="soap_success" method="processSuccess" ref="soapBean"/>
        <camel:bean id="published_log"  method="info('Message - SUCCESS')" ref="logger"/>
            <doCatch>
                <camel:exception>java.lang.Exception</camel:exception>
                <handled>
                    <constant>true</constant>
                </handled>
                <to uri="bean:soapBean?method=processGenericError"/>
        </doCatch>
      </doTry>
    </route>
</camelContext>

在记录消息“Message - SUCCESS”后抛出错误。 :

<camel:bean id="published_log"  method="info('Message - SUCCESS')" ref="logger"/>

我添加<stop/>但没有运气,仍然会抛出错误:在complete()或任何dispatch()方法之后调用getRequest()是非法的

1 个答案:

答案 0 :(得分:0)

而不是Given user with ios device "${device.name}"

只是target.process(exchange);