Appends to the path of the URL @param uri the URI @param append the path to append @return the final URL version
(URI uri, String append)
| 902 | * @return the final URL version |
| 903 | */ |
| 904 | protected static URI appendUrlPath(URI uri, String append) { |
| 905 | if (append == null || append.isEmpty()) { |
| 906 | return uri; |
| 907 | } |
| 908 | if (append.startsWith("/")) { |
| 909 | append = append.substring(1); |
| 910 | } |
| 911 | if (uri.getQuery() != null && !uri.getQuery().isEmpty()) { |
| 912 | append += "?" + uri.getQuery(); |
| 913 | } |
| 914 | if (!uri.getPath().endsWith("/")) { |
| 915 | append = uri.getPath() + "/" + append; |
| 916 | } |
| 917 | return uri.resolve(append); |
| 918 | } |
| 919 | |
| 920 | /** |
| 921 | * Guesses the type of file, based on file name suffix Returns "application/octet-stream" if no |