/*
(non-Javadoc)
@see org.springframework.hateoas.LinkBuilder#slash(java.lang.Object)
329913
public T slash(@Nullable Object object) {

		object = object instanceof Optional ? ((Optional<?>) object).orElse(null) : object;

		if (object == null) {
			return getThis();
		}

		String path = object.toString();

		if (path.endsWith("#")) {
			path = path.substring(0, path.length() - 1);
		}

		if (!StringUtils.hasText(path)) {
			return getThis();
		}

		path = path.startsWith("/") ? path : "/".concat(path);

		return slash(UriComponentsBuilder.fromUriString(path).build(), false);
	}
69946
protected String getRequestUrl(String key) throws Exception {
        String result = "";
        try {
            result = this.methods.get(key)[0];
        } catch (Exception ex) {
            throw new Exception("Unknown method key: " + key);
        }
        return result;
    }
253064
private void appendUrlToken(FastStringWriter actualUriBuf, Object token, String charset) {
        actualUriBuf.append(SLASH).append(urlEncode(token, charset));
    }
1215390
public static String normalizeSlashes(final String path) {
        // prepare
        final StringBuilder builder = new StringBuilder(path);
        boolean modified = false;

        // remove all trailing '/'s except the first one
        while (builder.length() > 0 && builder.length() != 1 && PATH_SEPARATOR == builder.charAt(builder.length() - 1)) {
            builder.deleteCharAt(builder.length() - 1);
            modified = true;
        }

        // add a slash at the beginning if one isn't present
        if (builder.length() == 0 || PATH_SEPARATOR != builder.charAt(0)) {
            builder.insert(0, PATH_SEPARATOR);
            modified = true;
        }

        // only create string when it was modified
        if (modified) {
            return builder.toString();
        }

        return path;
    }
1351968
public static String urlEncode(String str) throws UnsupportedEncodingException {
    // Preserve original behavior that passing null for an object id will lead
    // to us actually making a request to /v1/foo/null
    if (str == null) {
      return null;
    } else {
      // Don't use strict form encoding by changing the square bracket control
      // characters back to their literals. This is fine by the server, and
      // makes these parameter strings easier to read.
      return URLEncoder.encode(str, CHARSET)
        .replaceAll("%5B", "[")
        .replaceAll("%5D", "]");
    }
  }
1055560
@RestrictTo(LIBRARY)
  public String url() {
    StringBuilder sb = new StringBuilder();

    sb.append("path");
    if (strokeWidth() != null) {
      sb.append("-").append(strokeWidth());
    }
    if (strokeColor() != null) {
      sb.append("+").append(strokeColor());
    }
    if (strokeOpacity() != null) {
      sb.append("-").append(strokeOpacity());
    }
    if (fillColor() != null) {
      sb.append("+").append(fillColor());
    }
    if (fillOpacity() != null) {
      sb.append("-").append(fillOpacity());
    }
    sb.append("(").append(polyline()).append(")");
    return sb.toString();
  }
731349
function( string ){
            string = $this.slash.clean( string );

            if( string[ 0 ] === $this.slash.get()) string = string.substr( 1 );
            if( string[ string.length -1 ] === $this.slash.get()) string = string.substr( 0, string.length -1 );

            return string;
        }
635425
public static String path(String path, int offset, int length) {
        try {
            Utf8StringBuilder builder = null;
            int end = offset + length;
            for (int i = offset; i < end; i++) {
                char c = path.charAt(i);
                switch (c) {
                    case '%':
                        if (builder == null) {
                            builder = new Utf8StringBuilder(path.length());
                            builder.append(path, offset, i - offset);
                        }
                        if ((i + 2) < end) {
                            char u = path.charAt(i + 1);
                            if (u == 'u') {
                                // TODO this is wrong. This is a codepoint not a char
                                builder.append((char) (0xffff & TypeUtil.parseInt(path, i + 2, 4, 16)));
                                i += 5;
                            } else {
                                builder.append((byte) (0xff & (TypeUtil.convertHexDigit(u) * 16
                                    + TypeUtil.convertHexDigit(path.charAt(i + 2)))));
                                i += 2;
                            }
                        } else {
                            throw new IllegalArgumentException("Bad URI % encoding");
                        }

                        break;

                    case ';':
                        if (builder == null) {
                            builder = new Utf8StringBuilder(path.length());
                            builder.append(path, offset, i - offset);
                        }

                        while (++i < end) {
                            if (path.charAt(i) == '/') {
                                builder.append('/');
                                break;
                            }
                        }

                        break;

                    default:
                        if (builder != null) {
                            builder.append(c);
                        }
                        break;
                }
            }

            if (builder != null) {
                return builder.toString();
            }
            if (offset == 0 && length == path.length()) {
                return path;
            }
            return path.substring(offset, end);
        } catch (Utf8Appendable.NotUtf8Exception e) {
            return decodeISO88591Path(path, offset, length);
        }
    }
1364641
private static String join(String typeMapping, String mapping) {
		return MULTIPLE_SLASHES.matcher(typeMapping.concat("/").concat(mapping)).replaceAll("/");
	}
160833
public RequestRoute to(String url) {
        Objects.requireNonNull(url, Required.URL.toString());
        
        if ('/' != url.charAt(0)) {
            url = "/" + url;
        }
        
        this.url = url;
        
        return this;
    }
280482
@Nullable
    public String getUrl() {
        if (getRepositoryUrl() == null)
            return null;
        return getRepositoryUrl() + "/" + getGroupId().replace('.', '/') + "/" + getArtifactId() + "/" + getVersion() + "/" + getFileNameWithBaseVersion();
    }
1162179
@Override
  public Map<String, Object> rewrite(boolean showDebugInfo) throws IOException {
    Map<String, Object> response = new HashMap<>();
    for (String statsItem : getStatsItems()) {
      if (statsItem.equals(CodecUtil.STATS_TYPE_SUM)) {
        response.put(statsItem, valueSum);
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_N)) {
        response.put(statsItem, valueN);
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_MEAN)) {
        response.put(statsItem, getValue(statsItem));
      } else {
        response.put(statsItem, null);
      }
    }
    if (errorNumber > 0) {
      Map<String, Object> errorResponse = new HashMap<String, Object>();
      for (Entry<String, Integer> entry : getErrorList().entrySet()) {
        errorResponse.put(entry.getKey(), entry.getValue());
      }
      response.put("errorNumber", errorNumber);
      response.put("errorList", errorResponse);
    }
    if (showDebugInfo) {
      response.put("sourceNumber", sourceNumber);
      response.put("stats", "basic");
    }
    return response;
  }
1307538
public String urlDecode(String s) {
        if (s == null || s.isEmpty()) {
            return s;
        }
        return URL.decodeQueryString(s);
    }
283162
function( string ){
            if( string[ string.length -1 ] !== $this.slash.get()) string = string + $this.slash.get();

            return string;
        }
1179407
public static PathImpl lookup(String url)
  {
    PathImpl pwd = getPwd();

    if (! url.startsWith("/")) {
      return pwd.lookup(url, null);
    }
    else {
      return PWD.lookup(url, null);
    }
  }
580516
public static String getUrl(final String url) throws Exception {
        return getUrl(new URL(url), null, null);
    }
1269603
@Override
   public String getTrimmedPath(String path)
   {
      if (path == null)
      {
         return "/";
      }
      if (!path.startsWith("/"))
      {
         try
         {
            path = new URL(path).getPath();
         }
         catch (MalformedURLException ex)
         {
            // ignore
            Logger.getLogger(JBossWSDestinationRegistryImpl.class).trace(ex);
         }
         if (!path.startsWith("/")) {
            path = "/" + path;
         }
      }
      return path;
   }