类 HttpUtils

java.lang.Object
com.baidu.mochow.util.HttpUtils

public class HttpUtils extends Object
  • 构造器详细资料

    • HttpUtils

      public HttpUtils()
  • 方法详细资料

    • normalizePath

      public static String normalizePath(String path)
      参数:
      path - the path string to normalize.
      返回:
      the normalized path string.
      另请参阅:
    • normalize

      public static String normalize(String value)
      参数:
      value - the string to normalize.
      返回:
      the normalized string.
    • generateHostHeader

      public static String generateHostHeader(URI uri)
      Returns a host header according to the specified URI. The host header is generated with the same logic used by apache http client, that is, append the port to hostname only if it is not the default port.
      参数:
      uri - the URI
      返回:
      a host header according to the specified URI.
    • isUsingNonDefaultPort

      public static boolean isUsingNonDefaultPort(URI uri)
      Returns true if the specified URI is using a non-standard port (i.e. any port other than 80 for HTTP URIs or any port other than 443 for HTTPS URIs).
      参数:
      uri - the URI
      返回:
      True if the specified URI is using a non-standard port, otherwise false.
    • getCanonicalQueryString

      public static String getCanonicalQueryString(Map<String,String> parameters, boolean forSignature)
    • appendUri

      public static URI appendUri(URI baseUri, String... pathComponents)
      Append the given path to the given baseUri. This method will encode the given path but not the given baseUri.
    • printRequest

      public static void printRequest(org.apache.http.client.methods.HttpRequestBase request)