We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ca4fa4 commit fb1a88aCopy full SHA for fb1a88a
api/src/main/java/org/asynchttpclient/uri/UriComponents.java
@@ -15,8 +15,10 @@
15
import java.net.URI;
16
import java.net.URISyntaxException;
17
18
-public class UriComponents {
+import org.asynchttpclient.util.MiscUtils;
19
20
+public class UriComponents {
21
+
22
public static UriComponents create(String originalUrl) {
23
return create(null, originalUrl);
24
}
@@ -104,6 +106,18 @@ public String toUrl() {
104
106
return sb.toString();
105
107
108
109
+ public String toRelativeUrl() {
110
+ StringBuilder sb = new StringBuilder();
111
+ if (MiscUtils.isNonEmpty(path))
112
+ sb.append(path);
113
+ else
114
+ sb.append('/');
115
+ if (query != null)
116
+ sb.append('?').append(query);
117
118
+ return sb.toString();
119
+ }
120
121
@Override
122
public String toString() {
123
// for now, but might change
0 commit comments