/** * Parses the query string. */ protected final void parseFormData(String queryString) throws IOException { if (queryString == null || queryString.length() < 3) { return; } String[] nameValuePairs = queryString.split("&"); for (String nameValuePair : nameValuePairs) { int x = nameValuePair.indexOf('='); if (x > 0) { String name = IOUtils.decodeURL(nameValuePair.substring(0, x)); String value = (x == nameValuePair.length() - 1 ? "" : IOUtils .decodeURL(nameValuePair.substring(x + 1))); addParameter(name, value); } else { String name = IOUtils.decodeURL(nameValuePair); addParameter(name, (String) null); } } }
/** * Splits the path into its fragments. */ public static String[] splitPath(final HttpServletRequest request) { assert request != null; int prefixLength = request.getContextPath().length() + request.getServletPath().length(); String p = request.getRequestURI().substring(prefixLength); if (p.length() == 0) { return new String[0]; } String[] result = p.substring(1).split("/"); for (int i = 0; i < result.length; i++) { result[i] = IOUtils.decodeURL(result[i]); // check for malicious characters for (int j = 0; j < result[i].length(); j++) { char c = result[i].charAt(j); if (c == '\n' || c == '\r' || c == '\b' || c == 0) { throw new CmisInvalidArgumentException("Invalid path!"); } } } return result; } }
for (Cookie cookie : request.getCookies()) { if (cookieName.equals(cookie.getName())) { cookieValue = IOUtils.decodeURL(cookie.getValue()); break;