Here you can find the source of sanitizeForNextUrl(String url)
public static String sanitizeForNextUrl(String url)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . j a v a 2 s. com*/ * Sanitizes the given URL for the parameter {@link Const.ParamsNames#NEXT_URL}. * The following characters will be sanitized: * <ul> * <li>&, to prevent the parameters of the next URL from being considered as * part of the original URL</li> * <li>%2B (encoded +), to prevent Google from decoding it back to +, * which is used to encode whitespace in some cases</li> * <li>%23 (encoded #), to prevent Google from decoding it back to #, * which is used to traverse the HTML document to a certain id</li> * </ul> * * @return the sanitized url or null (if the parameter was null). */ public static String sanitizeForNextUrl(String url) { if (url == null) { return null; } return url.replace("&", "${amp}").replace("%2B", "${plus}") .replace("%23", "${hash}"); } }