Spring Cloud Netflix Zuul源码分析之请求处理篇-上
dispatcherservlet -> doDispatch( -> getHandler(HandlerExecutionChain) {
该过程会通过getHandlerInternal方法根据 lookupPath(请求路径)、request(请求)调用ZuulHandlerMapping.lookupHandler方法查找匹配的handler。如果没有
} ) ->doService
SimpleControllerHandlerAdapter.handle
zuulcontroller .handleRequest
ZuulServlet.service{
//Zuul的主要流程发生在ZuulServlet中,它的调用流程如下:
DispatcherServlet.doService
DispatcherServlet.doDispatch
SimpleControllerHandlerAdapter.handle
ZuulController.handleRequest
ServletWrappingController.handleRequestInternal
ZuulServlet.service
RibbonRoutingFilterpublic Object run() { RequestContext context = RequestContext.getCurrentContext(); this.helper.addIgnoredHeaders(); try { RibbonCommandContext commandContext = buildCommandContext(context); ClientHttpResponse response = forward(commandContext); setResponse(response); return response; } catch (ZuulException ex) { throw new ZuulRuntimeException(ex); } catch (Exception ex) { throw new ZuulRuntimeException(ex); } }
栈信息
java.lang.Thread.State: RUNNABLE at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.getRequestBody(RibbonRoutingFilter.java:199) at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.buildCommandContext(RibbonRoutingFilter.java:126) at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:105) at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) at