截取资源标识 @param uri 统一资源标识符 @param path 虚拟路径 @return
(String uri,String path)
| 107 | * @return |
| 108 | */ |
| 109 | public static String baseURI(String uri,String path){ |
| 110 | if(uri != null && !uri.isEmpty()){ |
| 111 | if(path != null && !path.isEmpty()){ |
| 112 | if(uri.length() > path.length() && uri.startsWith(path)){ |
| 113 | uri = uri.substring(path.length()); |
| 114 | } |
| 115 | } |
| 116 | //删除左斜杆 |
| 117 | if(uri.startsWith("/")){ |
| 118 | uri = uri.substring(1); |
| 119 | } |
| 120 | return uri; |
| 121 | } |
| 122 | return ""; |
| 123 | } |
| 124 | |
| 125 | |
| 126 |
no test coverage detected