URI Resolve1() Example
Resolves the given URI against this URI.
URIclass Resolve1() method example. This example shows you how to use Resolve1() method.This method Resolves the given URI against this URI.
Here is the code:-
/**
* @Program that Resolves the given URI against this URI.
* Resolve1.java
* Author:-RoseIndia Team
* Date:-24-jun-2008
*/
import java.net.*;
public class Resolve1 {
public static void main(String[] args) throws 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 new URI is: " + uri);
//Resolves the given URI against this URI.
System.out.println("Given URI against this URI is: " + uri.resolve(new URI("http://java.sun.com/javase/6/docs/api/")));
}
} |
Output of the program:-
Given new URI is: http://girish@tewari.com:8080/mail/?open#inbox
Given URI against this URI is: http://java.sun.com/javase/6/docs/api/ |
|