Mega Code Archive

 
Categories / Java Book / 006 Networking
 

0359 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; public class Main { public static void main(String[] args) throws URISyntaxException { URI uri = new URI("http://rntsoft.com/./"); System.out.println("Normalized URI = " + uri.normalize()); } } Output: Normalized URI = http://rntsoft.com/