The definition of the URI is: Uniform Resource Identifier;
For a URL, the definition is: Uniform Resource Locator.
The difference is that the URI represents the path to the requesting server and defines such a resource. The URL also shows you how to access the resource
The URL is a subclass of the URI, that is, the URL is a URI, and the URI is not necessarily a URL.
The URL must be an absolute path and the URI can be a relative path.
In Java, the test is as follows:
Program:
public void Dofilter (ServletRequest request, servletresponse response, Filterchain Filterchain) throws IOException,
servletexception {
//TODO auto-generated method Stub
System.out.println (' do filter ');
String uri= ((httpservletrequest) request). Getrequesturi ();
StringBuffer url= (httpservletrequest) request). Getrequesturl ();
System.out.println ("uri:" +uri);
System.out.println ("URL:" +url);
Filterchain.dofilter (request, response);
Output:
URI:/favicon.ico
Url:http://localhost:8090/favicon.ico