Here you can find the source of resolveGoogleRedirect(String url)
public static String resolveGoogleRedirect(String url) throws URISyntaxException, UnsupportedEncodingException
//package com.java2s; //License from project: Apache License import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; import java.net.URLDecoder; public class Main { /** Exctract redirect target from google's redirect url */ public static String resolveGoogleRedirect(String url) throws URISyntaxException, UnsupportedEncodingException { String query = new URI(url).getRawQuery(); for (String param : query.split("&")) if (param.contains("=")) { String[] parts = param.split("="); if (parts.length == 2 && parts[0].equals("url")) { return URLDecoder.decode(parts[1], "UTF-8"); }//from w w w . j a va 2 s . c o m } throw new IllegalArgumentException("google redirect not found for url: " + url); } }