Tomcat源码框架图+RestEasy UML
2019-01-31 17:16:10 0 举报
tomcat、UML、resteasy
作者其他创作
大纲/内容
Socket
Wrapper
单向关联
依赖
Tomcat容器
Context
JBossthreadrun()
Engine
1. providerFactory.registerProvider2. providerFactory.registerProviderInstance//provider主要是resteasy.plugins.providers包下的类,可以是自带的,也可以是拓展包,比如resteasy-jackon-provider3. dispatcher.getRegistry().addPerRequestResource4. dispatcher.getRegistry().addSingletonResource//处理@path资源,生成rootSegment及invoker,用于mapping
HttpServletDispatcher
# servletContainerDispatcher: ServletContainerDispatcher
+ init(ServletConfig):void + destory()+ font color=\"#007fff\
实现
ThreadLocalResteasyProviderFactory
- delegate : ThreadLocalStack<ResteasyProviderFactory>
+getDelegate():ResteasyProviderFactory
ApplicationFiterChain
调用ResourceMethod.invoke调用具体业务实现类调用栈:ResourceMethod.invokeMethodInjectorImpl.invokeDelegatingMehodAccessorImpl.invokeNativeMethodAccessorImpl.invoke业务类UserService.getUsers()
处理资源,匹配invokder;ResourceMethod invoker = new ResourceMethod()// 是Http请求存到ResourceMethod生成invoker;ResourceLocator locator = new ResourceLocator()// 不是则生成ResourceLocator生成locator
Host
ResourceMethodRegistry
# size:int //共有多少种@path路径# providerFactory:ResteasyProviderFactory # rootSegment:RootSegment
CoyoteAdapterconnector与容器的桥梁生成给conector使用的req和res调用容器管道
HTTPMethod:GET \\ POST \\ PUT \\ DELETE \\ HEAD \\ OPTIONS
组合
继承
处理拦截器、@Produces
处理流程
JIOEndPoint处理socket
Servlet容器
Http11ProtocolHttp11Connector异步处理Http请求
HttpServlet
ServletContainerDispatcher
# dispatcher :Dispatcher # providerFactory :ResteasyProviderFactory # deployment: ResteasyDeployment# requestFactory: HttpRequestFactory# responseFactory: HttpResponseFactory- servletMappingPrefix : void //配置的拦截路径
XXXValve
双向关联
dispatcher.invoke
聚合
SynchronousDispatcher
# preprocessExtensions(HttpRequest):void+ addHttpPreprocessor(HttpRequestPreprocessor)# handleXXException()+ getInvoker(HttpRequest):ResourceInvokerspan style=\"font-size: inherit;\
ResteasyProviderFactory
# messageBodyReaders : MediaTypeMap<SortedKey<MessageBodyReader>># messageBodyWriters : MediaTypeMap<SortedKey<MessageBodyWriter>># InterceptorRegistry <T>// 各种拦截器实例# pfr:static AtomicReference<ResteasyProviderFactory> span style=\
收藏
0 条评论
下一页
为你推荐
查看更多