URL and URI

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.