HttpUtil { public static String decodeUtf8UriParam(final String value) { if (value != null) { if (value.indexOf('%') == -1) { return value; } final String uri = value.replace("+", "%2B"); try { return URLDecoder.decode(uri, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } return null; }  static String dumpRequest(final HttpServletRequest request); static String decodeUtf8UriParam(final String value); static String encodeUtf8UriParam(final String value); static Map<String, List<String>> getParameters(final String requestURL,
                                                          final Set<String> pathVariables); static Map<String, List<String>> getParameters(final String requestURL,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static Map<String, List<String>> getParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables); static Map<String, List<String>> getParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static Map<String, List<String>> allParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables); static Map<String, List<String>> allParameters(final HttpServletRequest request,
                                                          final Set<String> pathVariables,
                                                          final boolean removeDuplicates); static String getSingleValue(final Object param); static String escapeForHTML(final String raw); static String escapeForHTMLAttribute(final String raw);  }
@Test public void testDecodeUtf8UriParam() throws Exception { assertEquals("Z+R", HttpUtil.decodeUtf8UriParam("Z+R")); assertEquals("Z+R", HttpUtil.decodeUtf8UriParam("Z%2BR")); assertEquals("Z R", HttpUtil.decodeUtf8UriParam("Z%20R")); assertEquals("белый", HttpUtil.decodeUtf8UriParam("%D0%B1%D0%B5%D0%BB%D1%8B%D0%B9")); assertEquals("белый", HttpUtil.decodeUtf8UriParam("бе%D0%BB%D1%8B%D0%B9")); assertEquals("бе/лый", HttpUtil.decodeUtf8UriParam("бе/%D0%BB%D1%8B%D0%B9")); assertEquals("бе/лый", HttpUtil.decodeUtf8UriParam("бе%2F%D0%BB%D1%8B%D0%B9")); assertEquals("бе{/}лый", HttpUtil.decodeUtf8UriParam("бе{/}%D0%BB%D1%8B%D0%B9")); assertEquals("бе{/}лый", HttpUtil.decodeUtf8UriParam("бе%7B%2F%7D%D0%BB%D1%8B%D0%B9")); }