Beispiel #1
0
 /**
  * Decodes the specified path segments.
  *
  * @param segments strings to be decoded
  * @return argument
  * @throws IllegalArgumentException invalid path segments
  */
 public static String[] decode(final String[] segments) {
   try {
     final int sl = segments.length;
     for (int s = 0; s < sl; s++) {
       segments[s] = URLDecoder.decode(segments[s], Prop.ENCODING);
     }
     return segments;
   } catch (final UnsupportedEncodingException ex) {
     throw new IllegalArgumentException(ex);
   }
 }
Beispiel #2
0
 /**
  * Adds parameters from the passed on request body.
  *
  * @param body request body
  * @param params map parameters
  */
 private static void addParams(final String body, final Map<String, String[]> params) {
   for (final String nv : body.split("&")) {
     final String[] parts = nv.split("=", 2);
     if (parts.length < 2) continue;
     try {
       params.put(parts[0], new String[] {URLDecoder.decode(parts[1], Token.UTF8)});
     } catch (final Exception ex) {
       Util.notexpected(ex);
     }
   }
 }