Skip to content

Commit ef6a0a4

Browse files
committed
depreacte Context.pathString in favor of Context.getRequestPath
1 parent 37bd152 commit ef6a0a4

File tree

36 files changed

+88
-97
lines changed

36 files changed

+88
-97
lines changed

docs/asciidoc/context.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Path parameter are part of the `URI`. To define a path variable you need to use
134134
----
135135
{
136136
get("/{name}", ctx -> {
137-
String pathString = ctx.pathString(); // <1>
137+
String pathString = ctx.getRequestPath(); // <1>
138138
139139
Value path = ctx.path(); // <2>
140140
@@ -152,7 +152,7 @@ Path parameter are part of the `URI`. To define a path variable you need to use
152152
----
153153
{
154154
get("/{name}") {
155-
val pathString = ctx.pathString() // <1>
155+
val pathString = ctx.getRequestPath() // <1>
156156
157157
val path = ctx.path() // <2>
158158

docs/asciidoc/mvc-api.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ class SuspendMvc {
737737
@Path("/delay")
738738
suspend fun delayed(ctx: Context): String {
739739
delay(100)
740-
return ctx.pathString()
740+
return ctx.getRequestPath()
741741
}
742742
}
743743

docs/asciidoc/responses.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ Probably one of most exciting new features of Jooby 2.x is the builtin integrati
481481
{
482482
coroutine {
483483
get("/") { // <1>
484-
ctx.pathString()
484+
ctx.getRequestPath()
485485
}
486486
}
487487
}
@@ -492,7 +492,7 @@ Probably one of most exciting new features of Jooby 2.x is the builtin integrati
492492
----
493493
{
494494
get("/") { // <2>
495-
ctx.pathString()
495+
ctx.getRequestPath()
496496
}
497497
}
498498
----

docs/asciidoc/routing.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,13 +1076,13 @@ public class App extends Jooby {
10761076
----
10771077
class Foo: Kooby({
10781078
1079-
get("/foo") { ctx.pathString() }
1079+
get("/foo") { ctx.getRequestPath() }
10801080
10811081
})
10821082
10831083
class Bar: Kooby({
10841084
1085-
get("/bar") { ctx.pathString() }
1085+
get("/bar") { ctx.getRequestPath() }
10861086
10871087
})
10881088
@@ -1091,7 +1091,7 @@ class App: Kooby({
10911091
10921092
use(Bar()) // <2>
10931093
1094-
get("/app") { ctx.pathString() } // <3>
1094+
get("/app") { ctx.getRequestPath() } // <3>
10951095
})
10961096
----
10971097

@@ -1123,7 +1123,7 @@ public class App extends Jooby {
11231123
----
11241124
class Foo: Kooby({
11251125
1126-
get("/foo") { ctx.pathString() }
1126+
get("/foo") { ctx.getRequestPath() }
11271127
11281128
})
11291129

examples/src/main/java/examples/BenchApp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public Message(String message) {
4848
});
4949

5050
get("/", ctx -> {
51-
System.out.println(ctx.pathString());
51+
System.out.println(ctx.getRequestPath());
5252
return ctx.send(MESSAGE_BYTE);
5353
});
5454

examples/src/main/java/examples/HelloApp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ public class HelloApp extends Jooby {
2424
});
2525

2626
get("/foo/bar", ctx -> {
27-
return ctx.pathString() + "oo";
27+
return ctx.getRequestPath() + "oo";
2828
});
2929
get("/foo/bar/", ctx -> {
30-
return ctx.pathString() + "oo/";
30+
return ctx.getRequestPath() + "oo/";
3131
});
3232

3333
get("/foo/{bar}", ctx -> {

jooby/src/main/java/io/jooby/Context.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ public interface Context extends Registry {
207207
* Request path without decoding (a.k.a raw Path) without query string.
208208
*
209209
* @return Request path without decoding (a.k.a raw Path) without query string.
210+
* @deprecated Use {{@link #getRequestPath()}}.
210211
*/
212+
@Deprecated
211213
@Nonnull String pathString();
212214

213215
/**

jooby/src/main/java/io/jooby/ErrorHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public interface ErrorHandler {
3737
+ ",\"reason\":\"" + statusCode.reason() + "\"}");
3838
} else if (text.equals(type)) {
3939
StringBuilder message = new StringBuilder();
40-
message.append(ctx.getMethod()).append(" ").append(ctx.pathString()).append(" ");
40+
message.append(ctx.getMethod()).append(" ").append(ctx.getRequestPath()).append(" ");
4141
message.append(statusCode.value()).append(" ").append(statusCode.reason());
4242
if (cause.getMessage() != null) {
4343
message.append("\n").append(XSS.json(cause.getMessage()));
@@ -121,7 +121,7 @@ public interface ErrorHandler {
121121
return new StringBuilder()
122122
.append(ctx.getMethod())
123123
.append(" ")
124-
.append(ctx.pathString())
124+
.append(ctx.getRequestPath())
125125
.append(" ")
126126
.append(statusCode.value())
127127
.append(" ")

jooby/src/main/java/io/jooby/ForwardingContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public ForwardingContext(@Nonnull Context context) {
115115
}
116116

117117
@Override @Nonnull public String pathString() {
118-
return ctx.pathString();
118+
return ctx.getRequestPath();
119119
}
120120

121121
@Nonnull @Override public String getRequestPath() {

jooby/src/main/java/io/jooby/SSLHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public SSLHandler(boolean useProxy) {
8585
buff.append(":").append(port);
8686
}
8787
}
88-
buff.append(ctx.pathString());
88+
buff.append(ctx.getRequestPath());
8989
buff.append(ctx.queryString());
9090
ctx.sendRedirect(buff.toString());
9191
}

0 commit comments

Comments
 (0)