URI ParseServerAuthority() Example

Attempts to parse this URI's authority component, if defined, into user-information, host, and port components.


URIclass ParseServerAuthority() method example. This example shows you how to use ParseServerAuthority() method.This method Attempts to parse this URI's authority component, if defined, into user-information, host, and port components.

Here is the code:-

/**
 * @Program that Attempts to parse this URI's authority component, if defined, 
 * into user-information, host, and port components.
 * ParseServerAuthority.java 
 * Author:-RoseIndia Team
 * Date:-24-jun-2008
 */
import java.net.*;

public class ParseServerAuthority {
public static void main(String[] argsthrows Exception {
        String scheme = "http";
        String userInfo = "girish";
        String host = "tewari.com";
        int port = 8080;
        String path = "/mail/";
        String query = "open";
        String fragment = "inbox";
        URI uri = new URI(scheme, userInfo, host, port, path, query, fragment);
        System.out.println("Given uri is: " + uri);
        //Attempts to parse this URI's authority component
        System.out.println("Given authority component is: " + uri.parseServerAuthority());
        
    }
}

Output of the program:-
 Given uri is: http://girish@tewari.com:8080/mail/?open#inbox
Given authority component is: http://girish@tewari.com:8080/mail/?open#inbox

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US