Java URL Create createURL(String url)

Here you can find the source of createURL(String url)

Description

create URL

License

Open Source License

Declaration

private static URL createURL(String url) 

Method Source Code

//package com.java2s;
/*/*from  ww w  .  j  a va  2s .c om*/
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/

import java.net.MalformedURLException;

import java.net.URL;

public class Main {
    private static URL createURL(String url) {
        URL requestURL;
        try {
            requestURL = new URL(url);
            return requestURL;
        } catch (MalformedURLException e) {
            try {
                requestURL = new URL("http://localhost:8080" + url);
                return requestURL;
            } catch (MalformedURLException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
        return null;
    }
}

Related

  1. createURL(String fileName)
  2. createUrl(String spec)
  3. createURL(String spec, URLStreamHandlerFactory urlHandlerFactory)
  4. createURL(String src, File basedir)
  5. createURL(String str)
  6. createURL(String url)
  7. createURL(String url)
  8. createURL(String url, String baseURI)
  9. createURL(String urlString)