URI Normalization

In this chapter you will learn:

  1. How to do URI Normalization

Normalization

Normalization is the process of removing unnecessary "." and ".." path segments from a hierarchical URI's path component.

URI declares a URI normalize() method for normalizing a URI.

import java.net.URI;
import java.net.URISyntaxException;
//  j a  v a  2s .  c  om
public class Main {
  public static void main(String[] args) throws URISyntaxException {
    URI uri = new URI("http://java2s.com/./");
    System.out.println("Normalized URI = " + uri.normalize());
  }
}

Output:

Next chapter...

What you will learn in the next chapter:

  1. How to do URI Resolution
Home » Java Tutorial » URL URI
URL
URL Creation
URL for jar file
URL Components
Convert file path to URL
URL Relative
URL Protocol
Read from URL
Compare URL
URLConnection
HTTP Header
URLConnection Post
Cookie
URLConnection Read
HttpURLConnection
HttpURLConnection Properties
HttpURLConnection proxy
HttpURLConnection Authenticator
HTTPS
JarURLConnection
Encode a URL
Decode a URL
URI
URI Normalization
URI Resolution
URI Relativization
Convert URI to URL
IP Address
IP Ping
NetworkInterface