/[projects]/miscJava/GenericJavaUtils/src/dk/thoerup/genericjavautils/HttpUtil.java
ViewVC logotype

Diff of /miscJava/GenericJavaUtils/src/dk/thoerup/genericjavautils/HttpUtil.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1350 by torben, Wed Apr 20 18:45:54 2011 UTC revision 1351 by torben, Wed Apr 20 18:52:29 2011 UTC
# Line 4  import java.io.ByteArrayOutputStream; Line 4  import java.io.ByteArrayOutputStream;
4  import java.io.IOException;  import java.io.IOException;
5  import java.io.InputStream;  import java.io.InputStream;
6  import java.io.OutputStream;  import java.io.OutputStream;
7    import java.io.UnsupportedEncodingException;
8  import java.net.HttpURLConnection;  import java.net.HttpURLConnection;
9  import java.net.URL;  import java.net.URL;
10  import java.net.URLConnection;  import java.net.URLConnection;
# Line 26  public class HttpUtil { Line 27  public class HttpUtil {
27                          String key = pair[0];                          String key = pair[0];
28                                                    
29                          String val = null;                          String val = null;
30                          if (pair.length == 2) {                                          if (pair.length == 2) {
31                                  val = URLDecoder.decode(pair[1]);                                  try {
32                                            val = URLDecoder.decode(pair[1], "UTF-8");
33                                    } catch (UnsupportedEncodingException e) {
34                                            val = pair[1]; // if decode fails try with the raw string
35                                    }
36                                    
37                          }                          }
38                                                    
39                          res.put(key, val);                          res.put(key, val);

Legend:
Removed from v.1350  
changed lines
  Added in v.1351

  ViewVC Help
Powered by ViewVC 1.1.20