@Override public String encodeRedirectURL(String baseUrl, Map<String, List<String>> parameters) { UrlBuilder builder = new UrlBuilder(baseUrl, getResponseCharacterEncoding()); builder.addParameters(parameters); return builder.createUrl(); }
public static void main(String[] args) { UrlBuilder ub = new UrlBuilder("http://www.naqichuan.com?cc=2&abcd=3"); System.out.println(ub.forPath("/n").build()); ub = new UrlBuilder("http://passport.{0}.{1}.naqichuan.com/{2}?cc=2&abcd=3&ccaa={1}"); ub.addValue("c"); ub.addValue("123"); ub.addValue("bbbb"); System.out.println(ub.forPath("/n{2}").build()); }
/** * @see javax.faces.context.ExternalContext#encodePartialActionURL(String) * @return */ @Override public String encodePartialActionURL(String url) { UrlBuilder builder = new UrlBuilder(url, getResponseCharacterEncoding()); return ((HttpServletResponse) response).encodeURL(builder.createUrl()); }