File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
api/src/main/java/org/asynchttpclient/uri Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 15
15
import java .net .URI ;
16
16
import java .net .URISyntaxException ;
17
17
18
- public class UriComponents {
18
+ import org . asynchttpclient . util . MiscUtils ;
19
19
20
+ public class UriComponents {
21
+
20
22
public static UriComponents create (String originalUrl ) {
21
23
return create (null , originalUrl );
22
24
}
@@ -104,6 +106,18 @@ public String toUrl() {
104
106
return sb .toString ();
105
107
}
106
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
+
107
121
@ Override
108
122
public String toString () {
109
123
// for now, but might change
You can’t perform that action at this time.
0 commit comments