Java URL Resolve resolveURL(URL url)

Here you can find the source of resolveURL(URL url)

Description

Returns a resolved equivalent of url, use with the platform relative urls

License

Open Source License

Parameter

Parameter Description
url a parameter

Return

URL

Declaration

public static URL resolveURL(URL url) 

Method Source Code

//package com.java2s;
/***************************************************************************************************
 * Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
 * accompanying materials are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * //from  w  w  w .j a  v  a2 s. co m
 * Contributors: Gorkem Ercan - initial API and implementation
 *               
 **************************************************************************************************/

import java.io.IOException;

import java.net.URL;
import org.eclipse.core.runtime.FileLocator;

public class Main {
    /**
     * Returns a resolved equivalent of url, use with the 
     * platform relative urls
     * 
     * @param url
     * @return URL
     */
    public static URL resolveURL(URL url) {
        try {
            return FileLocator.resolve(url);
        } catch (IOException e) {
            //ignore
        }
        return null;
    }
}

Related

  1. resolveRootUrl(Class knownClass)
  2. resolveUrl(String url, Properties properties)
  3. resolveURL(String urlValue)
  4. resolveURL(URL base, String target)
  5. resolveURL(URL contextURL, String url)
  6. resolveWsURI(String url)
  7. resolveXmlConfigUrl(@Nullable URL defaultXmlConfigUrl)
  8. reverseUrl(String urlString)