Java URL Connection getURLForward(URL url)

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

Description

get URL Forward

License

Apache License

Declaration

public static URL getURLForward(URL url) throws Exception 

Method Source Code

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

import java.net.URL;
import java.net.URLConnection;

public class Main {
    public static URL getURLForward(URL url) throws Exception {
        URLConnection con = url.openConnection();
        String location = con.getHeaderField("Location");
        if (location != null) {
            return new URL(location);
        }//from   ww  w.j a  va 2  s  .c om
        return url;
    }
}

Related

  1. getUrlContent(String urlAddress)
  2. getURLContents(URL u, Map data)
  3. getURLContentsAsString(URL url)
  4. getURLDataList(URL StrurlStringing)
  5. getUrlEncoding(URLConnection connection)
  6. getURLInputStream(final URL url)
  7. getUrlSource(String url)
  8. getURLStream(URL url, int level)
  9. getWebPageHtmlContent(String url)