gpt4 book ai didi

org.springframework.cloud.netflix.zuul.filters.ZuulProperties.getRoutes()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 05:54:49 25 4
gpt4 key购买 nike

本文整理了Java中org.springframework.cloud.netflix.zuul.filters.ZuulProperties.getRoutes()方法的一些代码示例,展示了ZuulProperties.getRoutes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZuulProperties.getRoutes()方法的具体详情如下:
包路径:org.springframework.cloud.netflix.zuul.filters.ZuulProperties
类名称:ZuulProperties
方法名:getRoutes

ZuulProperties.getRoutes介绍

暂无

代码示例

代码示例来源:origin: org.springframework.cloud/spring-cloud-netflix-zuul

/**
 * Compute a map of path pattern to route. The default is just a static map from the
 * {@link ZuulProperties}, but subclasses can add dynamic calculations.
 */
protected Map<String, ZuulRoute> locateRoutes() {
  LinkedHashMap<String, ZuulRoute> routesMap = new LinkedHashMap<>();
  for (ZuulRoute route : this.properties.getRoutes().values()) {
    routesMap.put(route.getPath(), route);
  }
  return routesMap;
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-netflix-zuul

protected void addConfiguredRoutes(Map<String, ZuulRoute> routes) {
  Map<String, ZuulRoute> routeEntries = this.properties.getRoutes();
  for (ZuulRoute entry : routeEntries.values()) {
    String route = entry.getPath();
    if (routes.containsKey(route)) {
      log.warn("Overwriting route " + route + ": already defined by "
          + routes.get(route));
    }
    routes.put(route, entry);
  }
}

代码示例来源:origin: mthizo247/spring-cloud-netflix-zuul-websocket

protected ZuulProperties.ZuulRoute resolveRoute(ZuulWebSocketProperties.WsBrokerage wsBrokerage) {
  ZuulProperties.ZuulRoute zuulRoute = zuulProperties.getRoutes().get(wsBrokerage.getRouteId());
  zuulRoute = zuulRoute == null ? zuulProperties.getRoutes().get(wsBrokerage.getId()) : zuulRoute;
  return zuulRoute;
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-netflix-zuul

private static List<String> getServiceIdsFromZuulProps(ZuulProperties zuulProperties) {
    Map<String, ZuulProperties.ZuulRoute> zuulRoutes = zuulProperties.getRoutes();
    Collection<ZuulProperties.ZuulRoute> registeredRoutes = zuulRoutes.values();
    List<String> serviceIds = new ArrayList<>();
    if (registeredRoutes != null) {
      for (ZuulProperties.ZuulRoute route: registeredRoutes) {
        String serviceId = route.getServiceId();
        if (serviceId != null) {
          serviceIds.add(serviceId);
        }
      }
    }
    return serviceIds;
  }
}

代码示例来源:origin: piomin/sample-spring-microservices-new

@Primary
@Bean
public SwaggerResourcesProvider swaggerResourcesProvider() {
  return () -> {
    List<SwaggerResource> resources = new ArrayList<>();
    properties.getRoutes().values().stream()
        .forEach(route -> resources.add(createResource(route.getServiceId(), route.getId(), "2.0")));
    return resources;
  };
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-netflix-zuul

public void addRoute(ZuulRoute route) {
  this.properties.getRoutes().put(route.getPath(), route);
  refresh();
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-consul-ui

@PostConstruct
public void init() {
  String url = String.format("http://%s:%s", consulProperties.getHost(),
      consulProperties.getPort());
  ZuulProperties.ZuulRoute route = new ZuulProperties.ZuulRoute("consulApi",
      "/v1/**", null, url, false, false);
  zuulProperties.getRoutes().put("consulApi", route);
  route = new ZuulProperties.ZuulRoute("consulUi",
      "/consul/**", null, url, true, false);
  zuulProperties.getRoutes().put("consulUi", route);
  zuulHandlerMapping.registerHandlers();
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-netflix-zuul

public void addRoute(String path, String location) {
  this.properties.getRoutes().put(path, new ZuulRoute(path, location));
  refresh();
}

代码示例来源:origin: Exrick/x-cloud

@Override
  public List<SwaggerResource> get() {

    List resources = new ArrayList<>();
    for(Map.Entry<String,ZuulProperties.ZuulRoute> entry: zuulProperties.getRoutes().entrySet()){
      String service = entry.getValue().getServiceId();
      if(service != null && entry.getValue().isStripPrefix()){
        SwaggerResource resource = new SwaggerResource();
        resource.setName(entry.getKey() + ":" + service);
        resource.setSwaggerVersion("2.0");
        resource.setLocation("/" + entry.getKey() + "/v2/api-docs");
        resources.add(resource);
      }
    }
    return resources;
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com