1 22 23 package caramel.util; 24 25 import java.net.*; 26 import java.util.*; 27 28 public class UrlUtils 29 { 30 31 private static URL _errorUrl; 32 33 public static URL getErrorUrl() 34 { 35 if( _errorUrl == null ) 36 { 37 try 38 { 39 _errorUrl = new URL( "http://fallback.net" ); 40 } 41 catch( MalformedURLException mex ) 42 { 43 } 44 } 45 46 return _errorUrl; 47 } 48 49 public static Map parseQueryString( String query ) 50 { 51 HashMap args = new HashMap(); 52 53 57 UrlQueryTokenizer tok = new UrlQueryTokenizer( query ); 58 while( tok.advance() ) 59 { 60 String key = tok.getKey(); 61 String value = tok.getValue(); 62 63 args.put( key, value ); 64 } 65 66 return args; 67 } 68 69 } 70 | Popular Tags |