/[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 1351 by torben, Wed Apr 20 18:52:29 2011 UTC revision 1421 by torben, Mon May 2 16:50:15 2011 UTC
# Line 16  import java.util.Map; Line 16  import java.util.Map;
16    
17  public class HttpUtil {  public class HttpUtil {
18                    
19            static public Map<String,String> decodeUri(String uri) {
20                    if (uri.indexOf('?') != -1) {
21                            String parts[] = uri.split("\\?");
22                            return decodeParams( parts[1] );
23                    } else {
24                            return new HashMap<String,String>();
25                    }
26                            
27                    
28                    
29            }
30            
31          static public Map<String,String> decodeParams(String str) {          static public Map<String,String> decodeParams(String str) {
32                  Map<String,String> res = new HashMap<String,String>();                  Map<String,String> res = new HashMap<String,String>();
33                                    
# Line 84  public class HttpUtil { Line 96  public class HttpUtil {
96                  }                  }
97          }          }
98                    
99            public static String getContentString(String  uri, int timeout) throws IOException {
100                    return getContentString(uri, timeout, "UTF-8");
101            }
102            
103            public static String getContentString(String  uri, int timeout, String encoding) throws IOException {
104                    byte[] buf = getContent(uri, timeout);
105                    return new String(buf, encoding);
106            }
107    
108          public static byte[] getContent(String uri, int timeout) throws IOException {          public static byte[] getContent(String uri, int timeout) throws IOException {
109                  URL url = new URL(uri);                  URL url = new URL(uri);

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

  ViewVC Help
Powered by ViewVC 1.1.20