Spring cloud gateway routing gateway source code analysis 03 02

CompositeRouteLocator The combination of a variety of  RouteLocator implementation class, providing RoutePredicateHandlerMapping unified entrance access route

CachingRouteLocator , Cache routing RouteLocator implementation class. RoutePredicateHandlerMapping call CachingRouteLocator the  RouteLocator#getRoutes() method to obtain the route.

Refresh Cache

 

RouteDefinitionRouteLocator 获取路由route

1. First, get RouteDefinition, then call convertToRoute converted into a route, filter and add the corresponding predicate

2. Look at acquisition predicate

   

  2.1 start acquiring local cache factory, get less than throwing an exception

  2.2 then loads the factory configuration of the config

  

2.3 Get existing cache, the cache if not, construct an http request to get predicate

 

3. Get Filter filters  

   3.1 to add the default filter defaultFilters

   Further added 3.2 of the filter configuration

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Routing-related factories, inheritance graph follows

RoutePredicateFactory as the core interface, create routePredicate, apply the following method

AfterRoutePredicateFactory request time satisfies at configuration time after 

BeforeRoutePredicateFactory request time satisfies at configuration time before

BetweenRoutePredicateFactory request time satisfies the time arranged between

CloudFoundryRouteServiceRoutePredicateFactory Paas cloud platform

CookieRoutePredicateFactory request specified Cookie  regular matches the specified value .

HeaderRoutePredicateFactory request specified Cookie  regular matches the specified value .

HostRoutePredicateFactory Request  Host  matches the specified value .

MethodRoutePredicateFactory request  Method  matches the specified value .

PathRoutePredicateFactory request  Path  matches the specified value

QueryRoutePredicateFactory request  QueryParam  matches the specified value

RemoteAddrRoutePredicateFactory: request source IP  in within the specified range

WeightRoutePredicateFactory: lies within the specified range of the Right

 

 

 

 

 

 

 

 

Published 386 original articles · won praise 2 · Views 9838

Guess you like

Origin blog.csdn.net/kuaipao19950507/article/details/105257200