test_class.file: base/lang/src/test/java/leap/lang/net/UrlsTest.java
test_class.identifier: UrlsTest
test_case.body: @Test
      public void testResolveUrlExpr(){
          URI uri1 = URI.create("http://127.0.0.1:8080/ctx");
          URI uri2 = URI.create("http://127.0.0.1/ctx/");
          String str1 = Urls.resolveUrlExpr("@{~/}path1",uri1);
          String str2 = Urls.resolveUrlExpr("@{~}path1",uri1);
          String str3 = Urls.resolveUrlExpr("@{/}path1",uri1);
          String str4 = Urls.resolveUrlExpr("@{^/}path1",uri1);
          String str5 = Urls.resolveUrlExpr("@{^}path1",uri1);
          Assert.assertEquals("http://127.0.0.1:8080/ctx/path1",str1);
          Assert.assertEquals("http://127.0.0.1:8080/ctxpath1",str2);
          Assert.assertEquals("/ctx/path1",str3);
          Assert.assertEquals("/path1",str4);
          Assert.assertEquals("path1",str5);
  
          str1 = Urls.resolveUrlExpr("@{~/}path1",uri2);
          str2 = Urls.resolveUrlExpr("@{~}path1",uri2);
          str3 = Urls.resolveUrlExpr("@{/}path1",uri2);
          str4 = Urls.resolveUrlExpr("@{^/}path1",uri2);
          str5 = Urls.resolveUrlExpr("@{^}path1",uri2);
          Assert.assertEquals("http://127.0.0.1/ctx/path1",str1);
          Assert.assertEquals("http://127.0.0.1/ctxpath1",str2);
          Assert.assertEquals("/ctx/path1",str3);
          Assert.assertEquals("/path1",str4);
          Assert.assertEquals("path1",str5);
      }
test_case.class_method_signature: UrlsTest.testResolveUrlExpr()
test_case.full_signature: @Test public void testResolveUrlExpr()
test_case.identifier: testResolveUrlExpr
test_case.invocations: create create resolveUrlExpr resolveUrlExpr resolveUrlExpr resolveUrlExpr resolveUrlExpr assertEquals assertEquals assertEquals assertEquals assertEquals resolveUrlExpr resolveUrlExpr resolveUrlExpr resolveUrlExpr resolveUrlExpr assertEquals assertEquals assertEquals assertEquals assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testResolveUrlExpr()
focal_class.declarator: CLASSPATH_ONE_URL_PREFIX = "classpath:"
focal_class.modifier: public static final
focal_class.original_string: public static final String CLASSPATH_ONE_URL_PREFIX = "classpath:";
focal_class.type: String
focal_class.var_name: CLASSPATH_ONE_URL_PREFIX
focal_class.declarator: CLASSPATH_ALL_URL_PREFIX = "classpath*:"
focal_class.modifier: public static final
focal_class.original_string: public static final String CLASSPATH_ALL_URL_PREFIX = "classpath*:";
focal_class.type: String
focal_class.var_name: CLASSPATH_ALL_URL_PREFIX
focal_class.declarator: FILE_URL_PREFIX    = "file:"
focal_class.modifier: public static final
focal_class.original_string: public static final String FILE_URL_PREFIX    = "file:";
focal_class.type: String
focal_class.var_name: FILE_URL_PREFIX
focal_class.declarator: JAR_URL_SEPARATOR  = "!/"
focal_class.modifier: public static final
focal_class.original_string: public static final String JAR_URL_SEPARATOR  = "!/";
focal_class.type: String
focal_class.var_name: JAR_URL_SEPARATOR
focal_class.declarator: PROTOCOL_SEPARATOR = "://"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROTOCOL_SEPARATOR = "://";
focal_class.type: String
focal_class.var_name: PROTOCOL_SEPARATOR
focal_class.declarator: PROTOCOL_FILE        = "file"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROTOCOL_FILE        = "file";
focal_class.type: String
focal_class.var_name: PROTOCOL_FILE
focal_class.declarator: PROTOCOL_JAR         = "jar"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROTOCOL_JAR         = "jar";
focal_class.type: String
focal_class.var_name: PROTOCOL_JAR
focal_class.declarator: PROTOCOL_ZIP         = "zip"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROTOCOL_ZIP         = "zip";
focal_class.type: String
focal_class.var_name: PROTOCOL_ZIP
focal_class.declarator: PROTOCOL_VFSZIP      = "vfszip"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROTOCOL_VFSZIP      = "vfszip";
focal_class.type: String
focal_class.var_name: PROTOCOL_VFSZIP
focal_class.declarator: PROTOCOL_VFS         = "vfs"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROTOCOL_VFS         = "vfs";
focal_class.type: String
focal_class.var_name: PROTOCOL_VFS
focal_class.declarator: PROTOCOL_WSJAR       = "wsjar"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROTOCOL_WSJAR       = "wsjar";
focal_class.type: String
focal_class.var_name: PROTOCOL_WSJAR
focal_class.declarator: PROTOCOL_CODE_SOURCE = "code-source"
focal_class.modifier: public static final
focal_class.original_string: public static final String PROTOCOL_CODE_SOURCE = "code-source";
focal_class.type: String
focal_class.var_name: PROTOCOL_CODE_SOURCE
focal_class.file: base/lang/src/main/java/leap/lang/net/Urls.java
focal_class.identifier: Urls
focal_class.class_method_signature: Urls.encode(String url)
focal_class.full_signature: public static String encode(String url)
focal_class.identifier: encode
focal_class.modifiers: public static
focal_class.parameters: (String url)
focal_class.return: String
focal_class.signature: String encode(String url)
focal_class.class_method_signature: Urls.encode(String url, String charset)
focal_class.full_signature: public static String encode(String url, String charset)
focal_class.identifier: encode
focal_class.modifiers: public static
focal_class.parameters: (String url, String charset)
focal_class.return: String
focal_class.signature: String encode(String url, String charset)
focal_class.class_method_signature: Urls.decode(String s)
focal_class.full_signature: public static String decode(String s)
focal_class.identifier: decode
focal_class.modifiers: public static
focal_class.parameters: (String s)
focal_class.return: String
focal_class.signature: String decode(String s)
focal_class.class_method_signature: Urls.decode(String s, String charset)
focal_class.full_signature: public static String decode(String s, String charset)
focal_class.identifier: decode
focal_class.modifiers: public static
focal_class.parameters: (String s, String charset)
focal_class.return: String
focal_class.signature: String decode(String s, String charset)
focal_class.class_method_signature: Urls.hasProtocolPrefix(String location)
focal_class.full_signature: public static boolean hasProtocolPrefix(String location)
focal_class.identifier: hasProtocolPrefix
focal_class.modifiers: public static
focal_class.parameters: (String location)
focal_class.return: boolean
focal_class.signature: boolean hasProtocolPrefix(String location)
focal_class.class_method_signature: Urls.isClasspath(String resourceLocation)
focal_class.full_signature: public static boolean isClasspath(String resourceLocation)
focal_class.identifier: isClasspath
focal_class.modifiers: public static
focal_class.parameters: (String resourceLocation)
focal_class.return: boolean
focal_class.signature: boolean isClasspath(String resourceLocation)
focal_class.class_method_signature: Urls.getQueryString(String uri)
focal_class.full_signature: public static String getQueryString(String uri)
focal_class.identifier: getQueryString
focal_class.modifiers: public static
focal_class.parameters: (String uri)
focal_class.return: String
focal_class.signature: String getQueryString(String uri)
focal_class.class_method_signature: Urls.appendQueryString(String url, String queryString)
focal_class.full_signature: public static String appendQueryString(String url, String queryString)
focal_class.identifier: appendQueryString
focal_class.modifiers: public static
focal_class.parameters: (String url, String queryString)
focal_class.return: String
focal_class.signature: String appendQueryString(String url, String queryString)
focal_class.class_method_signature: Urls.appendQueryParams(String url, String name, String value)
focal_class.full_signature: public static String appendQueryParams(String url, String name, String value)
focal_class.identifier: appendQueryParams
focal_class.modifiers: public static
focal_class.parameters: (String url, String name, String value)
focal_class.return: String
focal_class.signature: String appendQueryParams(String url, String name, String value)
focal_class.class_method_signature: Urls.removeQueryString(String url)
focal_class.full_signature: public static String removeQueryString(String url)
focal_class.identifier: removeQueryString
focal_class.modifiers: public static
focal_class.parameters: (String url)
focal_class.return: String
focal_class.signature: String removeQueryString(String url)
focal_class.class_method_signature: Urls.isUrl(String resourceLocation)
focal_class.full_signature: public static boolean isUrl(String resourceLocation)
focal_class.identifier: isUrl
focal_class.modifiers: public static
focal_class.parameters: (String resourceLocation)
focal_class.return: boolean
focal_class.signature: boolean isUrl(String resourceLocation)
focal_class.class_method_signature: Urls.isFileUrl(URL url)
focal_class.full_signature: public static boolean isFileUrl(URL url)
focal_class.identifier: isFileUrl
focal_class.modifiers: public static
focal_class.parameters: (URL url)
focal_class.return: boolean
focal_class.signature: boolean isFileUrl(URL url)
focal_class.class_method_signature: Urls.isJarUrl(URL url)
focal_class.full_signature: public static boolean isJarUrl(URL url)
focal_class.identifier: isJarUrl
focal_class.modifiers: public static
focal_class.parameters: (URL url)
focal_class.return: boolean
focal_class.signature: boolean isJarUrl(URL url)
focal_class.class_method_signature: Urls.toURI(URL url)
focal_class.full_signature: public static URI toURI(URL url)
focal_class.identifier: toURI
focal_class.modifiers: public static
focal_class.parameters: (URL url)
focal_class.return: URI
focal_class.signature: URI toURI(URL url)
focal_class.class_method_signature: Urls.toURI(String location)
focal_class.full_signature: public static URI toURI(String location)
focal_class.identifier: toURI
focal_class.modifiers: public static
focal_class.parameters: (String location)
focal_class.return: URI
focal_class.signature: URI toURI(String location)
focal_class.class_method_signature: Urls.getJarFileURL(URL jarUrl)
focal_class.full_signature: public static URL getJarFileURL(URL jarUrl)
focal_class.identifier: getJarFileURL
focal_class.modifiers: public static
focal_class.parameters: (URL jarUrl)
focal_class.return: URL
focal_class.signature: URL getJarFileURL(URL jarUrl)
focal_class.class_method_signature: Urls.setUseCachesIfNecessary(URLConnection con)
focal_class.full_signature: public static void setUseCachesIfNecessary(URLConnection con)
focal_class.identifier: setUseCachesIfNecessary
focal_class.modifiers: public static
focal_class.parameters: (URLConnection con)
focal_class.return: void
focal_class.signature: void setUseCachesIfNecessary(URLConnection con)
focal_class.class_method_signature: Urls.getQueryString(Map<String, String> map)
focal_class.full_signature: public static String getQueryString(Map<String, String> map)
focal_class.identifier: getQueryString
focal_class.modifiers: public static
focal_class.parameters: (Map<String, String> map)
focal_class.return: String
focal_class.signature: String getQueryString(Map<String, String> map)
focal_class.class_method_signature: Urls.getQueryStringBuilder(Map<String, String> map)
focal_class.full_signature: public static StringBuilder getQueryStringBuilder(Map<String, String> map)
focal_class.identifier: getQueryStringBuilder
focal_class.modifiers: public static
focal_class.parameters: (Map<String, String> map)
focal_class.return: StringBuilder
focal_class.signature: StringBuilder getQueryStringBuilder(Map<String, String> map)
focal_class.class_method_signature: Urls.queryStringToMap(String queryString)
focal_class.full_signature: public static Map<String, String> queryStringToMap(String queryString)
focal_class.identifier: queryStringToMap
focal_class.modifiers: public static
focal_class.parameters: (String queryString)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> queryStringToMap(String queryString)
focal_class.class_method_signature: Urls.resolveUrlExpr(String expression, URI uri)
focal_class.full_signature: public static String resolveUrlExpr(String expression, URI uri)
focal_class.identifier: resolveUrlExpr
focal_class.modifiers: public static
focal_class.parameters: (String expression, URI uri)
focal_class.return: String
focal_class.signature: String resolveUrlExpr(String expression, URI uri)
focal_class.class_method_signature: Urls.getExpressionValue(String expression, URI uri)
focal_class.full_signature: protected static String getExpressionValue(String expression, URI uri)
focal_class.identifier: getExpressionValue
focal_class.modifiers: protected static
focal_class.parameters: (String expression, URI uri)
focal_class.return: String
focal_class.signature: String getExpressionValue(String expression, URI uri)
focal_class.class_method_signature: Urls.Urls()
focal_class.full_signature: protected  Urls()
focal_class.identifier: Urls
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.signature:  Urls()
focal_method.body: public static String resolveUrlExpr(String expression, URI uri){
  		int i = 0;
  		StringBuilder source = new StringBuilder(expression);
  		StringBuilder builder = new StringBuilder();
  		while (source.length()>0){
  			char c = source.charAt(i);
  			source.deleteCharAt(i);
  			if(c == '@'){
  				if(source.charAt(i) == '{'){
  					source.deleteCharAt(i);
  					int index = source.indexOf("}");
  					if(-1 == index){
  						throw new IllegalArgumentException("error server url expression:"+expression);
  					}
  					String exp = source.substring(0,index);
  					source.delete(0,index+1);
  					builder.append(getExpressionValue(exp,uri));
  				}
  			}else {
  				if(c != '/' || builder.length() == 0){
  					builder.append(c);
  				}else if(builder.charAt(builder.length()-1)!='/'){
  					builder.append(c);
  				}
  			}
  		}
  		return builder.toString();
  	}
focal_method.class_method_signature: Urls.resolveUrlExpr(String expression, URI uri)
focal_method.full_signature: public static String resolveUrlExpr(String expression, URI uri)
focal_method.identifier: resolveUrlExpr
focal_method.invocations: length charAt deleteCharAt charAt deleteCharAt indexOf substring delete append getExpressionValue length append charAt length append toString
focal_method.modifiers: public static
focal_method.parameters: (String expression, URI uri)
focal_method.return: String
focal_method.signature: String resolveUrlExpr(String expression, URI uri)