logo

URL

Last Updated: 2024-01-22

URI vs URL

  • URI
    • URIs are Opaque Identifiers.
    • URI can be used to represent anything (including Non-Document Resources).
    • There’s no guarantee that a URI has a representation.
    • A URI is nothing but an identifier.
    • URI is the super set of URL.
  • URL
    • A URL is an identifier that can be dereferenced.
    • A URL is a URI that MUST include how to locate the resource.
    • A URL is a URI that is hierarchical and absolute.
    • A URL is always a URI.

Encoding URL

Translates a string into application/x-www-form-urlencoded format using a specific encoding scheme.

Is urlencoding required? It depends on the Content-Type in the HTTP headers. A value of application/x-www-form-urlencoded means that your POST body will need to be URL encoded just like a GET parameter string. A value of multipart/form-data means that you'll be using content delimiters and NOT url encoding the content.

E.g. in Java

String[] paths = new String[]{path};
String encodedPaths = URLEncoder.encode(Arrays.toString(paths), "UTF-8");

Underscore

Based on the RFC2396, the URL shouldn't contains underscore