Java URL Query Build getQueryUrl(String word, Integer page)

Here you can find the source of getQueryUrl(String word, Integer page)

Description

get Query Url

License

Apache License

Declaration

public static String getQueryUrl(String word, Integer page) throws UnsupportedEncodingException 

Method Source Code

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

import java.io.UnsupportedEncodingException;

import java.net.URLEncoder;

public class Main {
    private static final String URL_HOST = "http://www.youtube.com";

    public static String getQueryUrl(String word, Integer page) throws UnsupportedEncodingException {
        if (word == null) {
            return null;
        }/*from ww w. ja v  a 2 s .  co  m*/
        String qp = (page == null) ? "" : ("&page=" + page);
        return URL_HOST + "/results?search_query=" + URLEncoder.encode(word, "UTF-8") + "&sm=3" + qp;
    }
}

Related

  1. getQueryString(final Map parameters, final boolean encode)
  2. getQueryString(Map parameters)
  3. getQueryString(Map parameters)
  4. getQueryString(String url)
  5. getQueryUrl(String word)
  6. getQueryURL(URL baseUrl, String[] parameters)
  7. getQueryValues(String input)
  8. mapToQueryString(Map parameters, String charSet)
  9. mapToQueryString(Map parameters, String charSet)