Skip to content

Commit 2213301

Browse files
committed
Fixing the build
1 parent add55b4 commit 2213301

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

java/client/src/org/openqa/selenium/remote/HttpSessionId.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ private HttpSessionId() {
2626
// Utility class
2727
}
2828

29+
/**
30+
* Scan {@code uri} for a session ID. This is identified by scanning for "{code /session/}" and
31+
* then extracting the next fragment of the URL. This means that both "{@code /session/foo}" and
32+
* "{@code /wd/hub/session/foo/bar}" would both identify the session id as being "foo".
33+
*/
2934
public static Optional<String> getSessionId(String uri) {
3035
int sessionIndex = uri.indexOf("/session/");
3136
if (sessionIndex != -1) {

java/server/src/org/openqa/selenium/grid/node/Node.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ protected Node(DistributedTracer tracer, UUID id, URI uri) {
109109

110110
Json json = new Json();
111111
routes = combine(
112+
// "getSessionId" is aggressive about finding session ids, so this needs to be the last
113+
// route the is checked.
114+
matching(req -> getSessionId(req.getUri()).map(SessionId::new).map(this::isSessionOwner).orElse(false))
115+
.using(() -> new ForwardWebDriverCommand(this)),
112116
get("/se/grid/node/owner/{sessionId}")
113117
.using((params) -> new IsSessionOwner(this, json, new SessionId(params.get("sessionId")))),
114118
delete("/se/grid/node/session/{sessionId}")
@@ -118,9 +122,7 @@ protected Node(DistributedTracer tracer, UUID id, URI uri) {
118122
post("/se/grid/node/session").using(() -> new NewNodeSession(this, json)),
119123
get("/se/grid/node/status")
120124
.using((req, res) -> res.setContent(json.toJson(getStatus()).getBytes(UTF_8))),
121-
get("/status").using(() -> new StatusHandler(this, json)),
122-
matching(req -> getSessionId(req.getUri()).map(SessionId::new).map(this::isSessionOwner).orElse(false))
123-
.using(() -> new ForwardWebDriverCommand(this))
125+
get("/status").using(() -> new StatusHandler(this, json))
124126
).build();
125127
}
126128

java/server/test/org/openqa/selenium/grid/node/NodeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public void eachSessionShouldReportTheNodesUrl() throws URISyntaxException {
309309
}
310310

311311
@Test
312-
public void quitingASessionShouldCauseASessionClosedEventToBeFired() {
312+
public void quittingASessionShouldCauseASessionClosedEventToBeFired() {
313313
AtomicReference<Object> obj = new AtomicReference<>();
314314
bus.addListener(SESSION_CLOSED, event -> obj.set(event.getData(Object.class)));
315315

0 commit comments

Comments
 (0)