Apache CXF 2.7.11 Internals

http://cxf.apache.org/docs/
http://cxf.apache.org/docs/cxf-architecture.html

Transports:
http----------- [Servlet, Jetty]---------jaxws[SOAP], jaxrs[REST] JSON support
jms [tcp, Apache Camel]
udp

Conduit for outgoing message sending.
Destination for receiving incoming messages.
1.Message handling flow:
destination-->incomingObserver[ChainInitiationObserver].onMessage-->inChain[PhaseInterceptorChain, from Bus,Service,Endpoint,Binding,Databinding,InMessage's InInterceptors].doIntercept(inMessage) at InPhases[PhaseManagerImpl:inPhases and outPhases, Ordered In/Out list definition]-->ServiceInvokerInterceptor[Phase.INVOKE<----->PhaseInterceptor.getPhase, when initializeDefaultInterceptors for a Service, service.getInInterceptors().add(ServiceInvokerInterceptor,OutgoingChainInterceptor,OneWayProcessorInterceptor.], OutgoingChainInterceptor.handleMessage-->outChain[from Bus,Service,Endpoint,Binding,Databinding,In/OutMessage's OutInterceptors].doIntercept(outMessage).
2.Services publishing:
ServerFactoryBean[frontend, e.g: JaxWsServerFactoryBean:JaxWsServiceFactoryBean]-->create Service, Endpoint, Server[initDestination:create destination]-->server.start()-->bindingFactory.addListener(destination, endpoint)-->destination[AbstractHTTPDestination-AbstractObservable].setMessageObserver(ChainInitiationObserver)-->destination.activate().
One Bus for all services publishing-->new JaxWsServerFactoryBean:JaxWsServiceFactoryBean:Service:Endpoint:Destination:Server=1:1:1:1:1:1
Specially for Jetty standalone HTTP server:
1.JettyHTTPDestination:JettyHTTPServerEngine:JetterServer=1:1:1
But JettyHTTPServerEngine:Port:JetterServer=1:1:1, so one Port just one JettyHTTPServerEngine and one JettyServer.
2.ServerImpl.initDestination-->destinationFactory[HTTPTransportFactory, see bus.getExtension-->(bus-extensions.txt)].getDestination(ei)-->create JettyHTTPDestination-->d.finalizeConfig()-->d.retrieveEngine-->  get the only one JettyHTTPServerEngine:JettyServer on the specific Port.
3.bus-extensions.txt
org.apache.cxf.transport.http.HTTPTransportFactory::true
org.apache.cxf.transport.http_jetty.JettyDestinationFactory::true
4.JettyHTTPDestination.activate()-->engine[JettyHTTPServerEngine].addServant( ServiceUrl, new JettyHTTPHandler) [synchronized]-->the JettyServer's contexts[ContextHandlerCollection].addHandler(new ContextHandler:JettyHTTPHandler)

jaxws:endpoint and jaxws:server
First, they are all for the server side configuration.
Second, jaxws:endpoint is coming from JAXWS API, and it is used to
configure the org.apache.cxf.jaxws.EndpointImpl[not org.apache.cxf.endpoint.EndpointImpl] which extends javax.xml.ws.Endpoint.
jaxws:server is for configuring the JaxWsServerFactoryBean, which is
coming from the Xfire API.
For the user who has the Xfire using experience, I think they will
prefer to use jaxws:server tag.
For the JAXWS API fans, jaxws:endpoint will be they first choice.
There are not much difference between the jaxws:endpoint and
jaxws:server, since the EndpointImpl is a wrapper class for the
JaxWsServerFactoryBean.

CXF Continuation API [JettyContinuationWrapper-->Jetty Server Continuation NIO API,
Servlet3Continuation,JMSContinuation]  Jax-ws UseAsyncMethod [ wsdl:enableAsyncMapping, https://jax-ws.java.net/nonav/customizations/http.java.sun.com.xml.n/element/enableasyncmapping.html]
The request handling process: on Phase.INVOKE ServiceInvokerInterceptor
AbstractJAXWSMethodInvoker.adjustMethodAndParams-->probe the @UseAsyncMethod and Async suffix and ContinuationProvider existing, Jetty continuation.suspend(0) and suspend the phaseChain[ Note:pls see PhaseInterceptorChain.doIntercept, if suspend, will rollback previous interceptor ,pause and throw SuspendedInvocationException, so the incomingObserver.onMessage will be interrupted, the Destination will catch and throw it to WebContext dispatch layer] , then return the UseAsyncMethod-->AbstractJAXWSMethodInvoker.invoke it and pass the JaxwsServerHandler[AsyncHandler] param, JaxwsServerHandler.waitFor the method invocation done[callback the JaxwsServerHandler.handleResponse to Jetty continuation.resume and notifyAll], when callback done,the phaseChain next loop pause and throw SuspendedInvocationException to interrupt the current request handling process. but the Jetty Server will re-dispatch this request, the phaseChain will resume[ incomingObserver.onMessage-->phaseChain.resume() ]
e.g: distribution\src\main\release\samples\jaxws_async\src\main\java\demo\hw\server\GreeterImpl

soap.udp-->publish service ws discovery
remove the cxf-services-ws-discovery-service-2.7.11.jar and cxf-services-ws-discovery-api-2.7.11.jar to disable it.
WS-Trust "Security Token Service" STS
Web Services Notification WSN

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值