gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-15 06:04:49 30 4
gpt4 key购买 nike

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

ZuulProperties.getPrefix介绍

暂无

代码示例

代码示例来源:origin: pig4cloud/pig

path = "/" + path;
if (StrUtil.isNotBlank(this.properties.getPrefix())) {
  path = this.properties.getPrefix() + path;
  if (!path.startsWith("/")) {
    path = "/" + path;

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

private boolean zuulHasGlobalPrefix(ZuulProperties zuulProperties) {
  return StringUtils.hasText(zuulProperties.getPrefix());
}

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

private boolean downstreamHasGlobalPrefix(ZuulProperties zuulProperties) {
  return (!zuulProperties.isStripPrefix()
      && StringUtils.hasText(zuulProperties.getPrefix()));
}

代码示例来源:origin: lexburner/zuul-gateway-demo

@Override
protected Map<String, ZuulRoute> locateRoutes() {
  LinkedHashMap<String, ZuulRoute> routesMap = new LinkedHashMap<String, ZuulRoute>();
  //从application.properties中加载路由信息
  routesMap.putAll(super.locateRoutes());
  //从db中加载路由信息
  routesMap.putAll(locateRoutesFromDB());
  //优化一下配置
  LinkedHashMap<String, ZuulRoute> values = new LinkedHashMap<>();
  for (Map.Entry<String, ZuulRoute> entry : routesMap.entrySet()) {
    String path = entry.getKey();
    // Prepend with slash if not already present.
    if (!path.startsWith("/")) {
      path = "/" + path;
    }
    if (StringUtils.hasText(this.properties.getPrefix())) {
      path = this.properties.getPrefix() + path;
      if (!path.startsWith("/")) {
        path = "/" + path;
      }
    }
    values.put(path, entry.getValue());
  }
  return values;
}

代码示例来源:origin: liuht777/Taroco

/**
 * 重写路由配置
 *
 * @return 路由表
 */
@Override
protected LinkedHashMap<String, ZuulProperties.ZuulRoute> locateRoutes() {
  //读取properties配置、eureka默认配置
  LinkedHashMap<String, ZuulProperties.ZuulRoute> routesMap = new LinkedHashMap<>(super.locateRoutes());
  log.debug("初始默认的路由配置完成");
  routesMap.putAll(locateRoutesFromCache());
  LinkedHashMap<String, ZuulProperties.ZuulRoute> values = new LinkedHashMap<>();
  for (Map.Entry<String, ZuulProperties.ZuulRoute> entry : routesMap.entrySet()) {
    String path = entry.getKey();
    if (!path.startsWith("/")) {
      path = "/" + path;
    }
    if (StrUtil.isNotBlank(this.properties.getPrefix())) {
      path = this.properties.getPrefix() + path;
      if (!path.startsWith("/")) {
        path = "/" + path;
      }
    }
    values.put(path, entry.getValue());
  }
  return values;
}

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

private String getRestoredPath(ZuulProperties zuulProperties, Route route,
    UriComponents redirectedUriComps) {
  StringBuilder path = new StringBuilder();
  String redirectedPathWithoutGlobal = downstreamHasGlobalPrefix(zuulProperties)
      ? redirectedUriComps.getPath()
          .substring(("/" + zuulProperties.getPrefix()).length())
      : redirectedUriComps.getPath();
  if (downstreamHasGlobalPrefix(zuulProperties)) {
    path.append("/" + zuulProperties.getPrefix());
  }
  else {
    path.append(zuulHasGlobalPrefix(zuulProperties)
        ? "/" + zuulProperties.getPrefix() : "");
  }
  path.append(downstreamHasRoutePrefix(route) ? "" : "/" + route.getPrefix())
      .append(redirectedPathWithoutGlobal);
  return path.toString();
}

代码示例来源:origin: tigerphz/tgcloud-master

path = "/" + path;
if (StringUtils.hasText(this.properties.getPrefix())) {
  path = this.properties.getPrefix() + path;
  if (!path.startsWith("/")) {
    path = "/" + path;

代码示例来源:origin: getheimdall/heimdall

path = "/" + path;
if (StringUtils.hasText(this.properties.getPrefix())) {
  path = this.properties.getPrefix() + path;
  if (!path.startsWith("/")) {
     path = "/" + path;

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

@Override
  public Object run() {

    RequestContext ctx = RequestContext.getCurrentContext();
    HttpServletRequest request = ctx.getRequest();

    Object accessToken = request.getParameter("accessToken");
    if(accessToken == null) {
      log.warn("AccessToken is empty!"+zuulProperties.getPrefix()+" "+zuulProperties.getServletPath()+" "+zuulProperties.getServletPattern());
      ctx.setSendZuulResponse(false);
      ctx.setResponseStatusCode(401);
      return null;
    }
    log.info("AccessToken ok");
    return null;
  }
}

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

path = "/" + path;
if (StringUtils.hasText(this.properties.getPrefix())) {
  path = this.properties.getPrefix() + path;
  if (!path.startsWith("/")) {
    path = "/" + path;

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

String prefix = this.properties.getPrefix();
if (prefix.endsWith("/")) {
  prefix = prefix.substring(0, prefix.length() - 1);

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