@Test public void testGetEncodedParameter_stopsAtUrlFragment() throws Exception { final String url = "url"; final String queryString = "first=&foo=bar#ignore"; final HttpRequest request = new HttpRequest(url, queryString); assertThat(request.getEncodedParameter("foo"), equalTo("bar")); }
public String getEncodedParameter(String name) { Matcher matcher = Pattern.compile(Pattern.quote(name) + "=([^&#]+)").matcher(queryString); if (matcher.find()) { return matcher.group(1); } else { return Util.urlEncoder(getParameter(name)); } }
HttpRequest { public String getEncodedParameter(String name) { Matcher matcher = Pattern.compile(Pattern.quote(name) + "=([^&#]+)").matcher(queryString); if (matcher.find()) { return matcher.group(1); } else { return Util.urlEncoder(getParameter(name)); } } }
HttpRequest { public String getEncodedParameter(String name) { Matcher matcher = Pattern.compile(Pattern.quote(name) + "=([^&#]+)").matcher(queryString); if (matcher.find()) { return matcher.group(1); } else { return Util.urlEncoder(getParameter(name)); } } @Deprecated  HttpRequest(String requestURL);  HttpRequest(String requestURL, String queryString); @Deprecated  HttpRequest(String requestURL, Map<String, List<String>> parameters);  HttpRequest(String requestURL, Map<String, List<String>> parameters, String queryString); }
HttpRequest { public String getEncodedParameter(String name) { Matcher matcher = Pattern.compile(Pattern.quote(name) + "=([^&#]+)").matcher(queryString); if (matcher.find()) { return matcher.group(1); } else { return Util.urlEncoder(getParameter(name)); } } @Deprecated  HttpRequest(String requestURL);  HttpRequest(String requestURL, String queryString); @Deprecated  HttpRequest(String requestURL, Map<String, List<String>> parameters);  HttpRequest(String requestURL, Map<String, List<String>> parameters, String queryString); HttpRequest addParameter(String name, String value); HttpRequest removeParameter(String name); String getRequestURL(); String getParameter(String name); List<String> getParameters(String name); Map<String, List<String>> getParameters(); String getEncodedParameter(String name); String getEncodedParameter(String name, String defaultValue); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
HttpRequest { public String getEncodedParameter(String name) { Matcher matcher = Pattern.compile(Pattern.quote(name) + "=([^&#]+)").matcher(queryString); if (matcher.find()) { return matcher.group(1); } else { return Util.urlEncoder(getParameter(name)); } } @Deprecated  HttpRequest(String requestURL);  HttpRequest(String requestURL, String queryString); @Deprecated  HttpRequest(String requestURL, Map<String, List<String>> parameters);  HttpRequest(String requestURL, Map<String, List<String>> parameters, String queryString); HttpRequest addParameter(String name, String value); HttpRequest removeParameter(String name); String getRequestURL(); String getParameter(String name); List<String> getParameters(String name); Map<String, List<String>> getParameters(); String getEncodedParameter(String name); String getEncodedParameter(String name, String defaultValue); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final Map<String, List<String>> EMPTY_PARAMETERS; }