1 20 package org.apache.cactus.internal.util; 21 22 import java.net.URL ; 23 24 29 public class UrlUtil 30 { 31 39 public static String getPath(URL theURL) 40 { 41 String file = theURL.getFile(); 42 String path = null; 43 44 if (file != null) 45 { 46 int q = file.lastIndexOf('?'); 47 48 if (q != -1) 49 { 50 path = file.substring(0, q); 51 } 52 else 53 { 54 path = file; 55 } 56 } 57 58 return path; 59 } 60 61 69 public static String getQuery(URL theURL) 70 { 71 String file = theURL.getFile(); 72 String query = null; 73 74 if (file != null) 75 { 76 int q = file.lastIndexOf('?'); 77 78 if (q != -1) 79 { 80 query = file.substring(q + 1); 81 } 82 else 83 { 84 query = ""; 85 } 86 } 87 88 return query; 89 } 90 } 91 | Popular Tags |