Java URL Decode decodeFormData(String formData)

Here you can find the source of decodeFormData(String formData)

Description

decode Form Data

License

Open Source License

Declaration

private static Map<String, String> decodeFormData(String formData) throws UnsupportedEncodingException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.UnsupportedEncodingException;

import java.util.HashMap;
import java.util.Map;

import java.net.URLDecoder;

public class Main {
    private static Map<String, String> decodeFormData(String formData) throws UnsupportedEncodingException {
        Map<String, String> decodedFormData = new HashMap<String, String>();
        String[] pairs = formData.split("\\&");
        for (int i = 0; i < pairs.length; i++) {
            String[] fields = pairs[i].split("=");
            String name = URLDecoder.decode(fields[0], "UTF-8");
            String value = URLDecoder.decode(fields[1], "UTF-8");
            decodedFormData.put(name, value);
        }/*w  ww.ja  v  a2 s.c  o  m*/
        return decodedFormData;
    }
}

Related

  1. decode(String value, String encoding)
  2. decodeAjax(String value)
  3. decodeAjaxParam(final String source)
  4. decodeArray(final String val)
  5. decodeCodedStr(String sourceStr, String targetCharset)
  6. decodeHtmlString(String inputString)
  7. decodeIfNeeded(String s)
  8. decodeInternally(String encoded)
  9. decodeJobHistoryFileName(String logFileName)