Java URL Create buildUrl(final String domain, final String path)

Here you can find the source of buildUrl(final String domain, final String path)

Description

Builds an URL given a domain and a path.

License

Open Source License

Parameter

Parameter Description
domain the domain
path the path

Return

the

Declaration

private static URL buildUrl(final String domain, final String path) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    /**//from   ww w  . j  a v  a 2  s .  c o  m
     * Builds an {@link URL} given a domain and a path.
     *
     * @param domain the domain
     * @param path the path
     * @return the {@link URL}
     */
    private static URL buildUrl(final String domain, final String path) {
        try {
            return new URL(new URL(domain), path);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. buildUrl(final String baseUrl, final Map params, final String... parts)
  2. buildUrl(final String baseUrl, final String basePath, final String[] parts)
  3. buildUrl(final String baseUrl, final String... parts)
  4. buildUrl(String base, Map params)
  5. buildUrl(String baseUrl, Map queryParams, String anchor)
  6. buildUrl(String context, String... relocations)
  7. buildUrl(String context, String... relocations)