Code example for URI

Methods: getFragment, getHost, getPath, getPort, getQuery, getScheme, getUserInfo

0
     * fragments set 
     * 
     * @param uri the URI to be assigned to the fragments 
     */ 
    public void setFragments(URI uri) {
        fragments[PROTOCOL] = uri.getScheme();
        fragments[USER_INFO] = uri.getUserInfo();
        fragments[HOST] = uri.getHost();
        // getPath method returns empty string when a path is not present 
        // Better to set 'null' instead 
        fragments[PATH] = ("".equals(uri.getPath()) ? null : uri.getPath());
        fragments[QUERY] = uri.getQuery();
        fragments[REF] = uri.getFragment();
        port = uri.getPort();
    } 
 
    public void setPort(int port) {
        this.port = port;
    } 
 
    public int getPort() {