Java URI Create GetURI(String host, String port, String resource)

Here you can find the source of GetURI(String host, String port, String resource)

Description

Get URI

License

LGPL

Declaration

public static String GetURI(String host, String port, String resource)
            throws MalformedURLException, URISyntaxException 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;

public class Main {
    public static String GetURI(String host, String port, String resource)
            throws MalformedURLException, URISyntaxException {
        if (!resource.startsWith("/")) {
            resource = "/" + resource;
        }//  w  w w. jav  a 2  s .  c o  m
        int portValue = 80;
        if (port.length() > 0) {
            portValue = Integer.parseInt(port);
        }
        return new URL("http", host, portValue, resource).toURI().toString();
    }
}

Related

  1. getURI(final String base, final String href)
  2. getURI(final String uri)
  3. getURI(List data, Integer col)
  4. getURI(String bucket, String key)
  5. getURI(String host, int port, String path, boolean isHTTPS)
  6. getURI(String path)
  7. getURI(String path)
  8. getURI(String path, String name)
  9. getURI(String protocol, String authority, String path, Hashtable params)

  10. HOME | Copyright © www.java2s.com 2016