{"id":449,"date":"2021-04-29T15:37:56","date_gmt":"2021-04-29T15:37:56","guid":{"rendered":"http:\/\/robinluo.top\/?p=449"},"modified":"2021-05-26T07:48:48","modified_gmt":"2021-05-26T07:48:48","slug":"zuul","status":"publish","type":"post","link":"https:\/\/robinluo.top\/?p=449","title":{"rendered":"zuul 1.x"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" src=\"https:\/\/upload-images.jianshu.io\/upload_images\/17428786-b0db03061d2c45d6.png?imageMogr2\/auto-orient\/strip|imageView2\/2\/w\/382\/format\/webp\" width=\"607\" height=\"300\"\/><\/figure>\n\n\n\n<p>zuul \u7f51\u5173\u5e94\u7528\u5206 1.X \u7248\u672c \u548c 2.X \u7248\u672c \u4e24\u8005\u76f8\u5dee\u5f88\u5927<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u8be6\u7ec6\u8bf4\u660ezuul 1.X \u7248\u672c<\/p>\n\n\n\n<p>\u5728\u539f\u59cb\u5728zuul-core \u5305\u4e2d \u6240\u6709\u8bf7\u6c42\u662f\u901a\u8fc7 com.netflix.zuul.http.ZuulServlet \u5728 \/zuul\/* \u4e0b\u5efa\u7acbservlet \u5165\u53e3  <\/p>\n\n\n\n<p>\u7136\u540e\u5728 zuulServlet\u7684service\u65b9\u6cd5\u4e2d \u6267\u884c zuulRunner \u53bb\u5904\u7406\u8bf7\u6c42<\/p>\n\n\n\n<p>\u7136\u540e\u4e0d\u540c\u8bf7\u6c42\u8def\u5f84\u4e0b\u4f1a\u4f7f\u7528 zuulRunner\u91cc\u9762\u7684\u4e0d\u540c\u7684 filterProcessor \u53bb\u5904\u7406 <\/p>\n\n\n\n<p>\u8b6c\u5982 \uff1a<\/p>\n\n\n\n<p>\u9759\u6001\u8def\u7531\u7684\u5730\u5740 \u7531\u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u7684\u8def\u7531\u5668\u5904\u7406 <\/p>\n\n\n\n<p>\u5fae\u670d\u52a1\u8def\u7531\u5730\u5740 \u7531ribbon\u7684\u63d0\u4f9b\u8def\u7531\u7b56\u7565 RibbonRoutingFilter<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img src=\"https:\/\/upload-images.jianshu.io\/upload_images\/17428786-d3cdfebdcd676432.png?imageMogr2\/auto-orient\/strip|imageView2\/2\/w\/726\/format\/webp\" alt=\"\"\/><\/figure>\n\n\n\n<p> \u6240\u6709\u7684\u8fd9\u4e9b\u5904\u7406\u8bf7\u6c42filter \u5176\u5b9e\u662f\u628a\u8bf7\u6c42\u91cd\u53d1\u5230\u5bf9\u5e94\u7684\u5730\u5740<\/p>\n\n\n\n<p>\u518d\u628a\u54cd\u5e94\u7ed3\u679c\u8fd4\u56de\u7ed9\u7f51\u5173\uff08\u8f6c\u53d1\uff09<\/p>\n\n\n\n<p>\u5177\u4f53\u5b9e\u73b0http\u8bf7\u6c42\u7684\u6846\u67b6\u53ef\u4ee5\u914d\u7f6e okhttp httpClient \u7b49<\/p>\n\n\n\n<p>\u548c spring-boot \u6574\u5408\u540e<\/p>\n\n\n\n<p>springmvc \u7528 org.springframework.cloud.netflix.zuul.web.ZuulController<\/p>\n\n\n\n<p>\u5305\u88c5\u4e86zuulServlet \uff08servletWrapper\uff09<\/p>\n\n\n\n<p>\u8fd8\u662f\u901a\u8fc7springMVC\u53bb\u5904\u7406\u7f51\u5173\uff01\uff01\uff01<\/p>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>zuul \u7f51\u5173\u5e94\u7528\u5206 1.X \u7248\u672c \u548c 2.X \u7248\u672c \u4e24\u8005\u76f8\u5dee\u5f88\u5927 \u4ee5\u4e0b\u8be6\u7ec6\u8bf4\u660ezuul 1.X \u7248\u672c \u5728\u539f\u59cb\u5728zuul-core \u5305\u4e2d \u6240\u6709\u8bf7\u6c42\u662f\u901a\u8fc7 com.netflix.zuul.http.ZuulServlet \u5728 \/zuul\/* \u4e0b\u5efa\u7acbservlet \u5165\u53e3 \u7136\u540e\u5728 zuulServlet\u7684service\u65b9\u6cd5\u4e2d \u6267\u884c zuulRunner \u53bb\u5904\u7406\u8bf7\u6c42 \u7136\u540e\u4e0d\u540c\u8bf7\u6c42\u8def\u5f84\u4e0b\u4f1a\u4f7f\u7528 zuulRunner\u91cc\u9762\u7684\u4e0d\u540c\u7684 filterProcessor \u53bb\u5904\u7406 \u8b6c\u5982 \uff1a \u9759\u6001\u8def\u7531\u7684\u5730\u5740 \u7531\u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u7684\u8def\u7531\u5668\u5904\u7406 \u5fae\u670d\u52a1\u8def\u7531\u5730\u5740 \u7531ribbon\u7684\u63d0\u4f9b\u8def\u7531\u7b56\u7565 RibbonRoutingFilter \u6240\u6709\u7684\u8fd9\u4e9b\u5904\u7406\u8bf7\u6c42filter \u5176\u5b9e\u662f\u628a\u8bf7\u6c42\u91cd\u53d1\u5230\u5bf9\u5e94\u7684\u5730\u5740 \u518d\u628a\u54cd\u5e94\u7ed3\u679c\u8fd4\u56de\u7ed9\u7f51\u5173\uff08\u8f6c\u53d1\uff09 \u5177\u4f53\u5b9e\u73b0http\u8bf7\u6c42\u7684\u6846\u67b6\u53ef\u4ee5\u914d\u7f6e okhttp httpClient \u7b49 \u548c spring-boot \u6574\u5408\u540e springmvc \u7528 org.springframework.cloud.netflix.zuul.web.ZuulController \u5305\u88c5\u4e86zuulServlet \uff08servletWrapper\uff09 \u8fd8\u662f\u901a\u8fc7springMVC\u53bb\u5904\u7406\u7f51\u5173\uff01\uff01\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[85,84],"_links":{"self":[{"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/posts\/449"}],"collection":[{"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/robinluo.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=449"}],"version-history":[{"count":7,"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/posts\/449\/revisions"}],"predecessor-version":[{"id":531,"href":"https:\/\/robinluo.top\/index.php?rest_route=\/wp\/v2\/posts\/449\/revisions\/531"}],"wp:attachment":[{"href":"https:\/\/robinluo.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robinluo.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robinluo.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}