|
20 | 20 | import com.beust.jcommander.JCommander;
|
21 | 21 | import com.beust.jcommander.ParameterException;
|
22 | 22 | import com.google.auto.service.AutoService;
|
| 23 | +import com.google.common.collect.ImmutableMap; |
| 24 | +import com.google.common.net.MediaType; |
23 | 25 | import io.opentracing.Tracer;
|
24 | 26 | import org.openqa.selenium.BuildInfo;
|
25 | 27 | import org.openqa.selenium.cli.CliCommand;
|
|
39 | 41 | import org.openqa.selenium.grid.sessionmap.SessionMap;
|
40 | 42 | import org.openqa.selenium.grid.sessionmap.local.LocalSessionMap;
|
41 | 43 | import org.openqa.selenium.netty.server.NettyServer;
|
| 44 | +import org.openqa.selenium.remote.http.Contents; |
| 45 | +import org.openqa.selenium.remote.http.HttpResponse; |
| 46 | +import org.openqa.selenium.remote.http.Route; |
42 | 47 |
|
43 | 48 | import java.util.logging.Logger;
|
44 | 49 |
|
| 50 | +import static org.openqa.selenium.remote.http.Route.get; |
| 51 | + |
45 | 52 | @AutoService(CliCommand.class)
|
46 | 53 | public class SessionMapServer implements CliCommand {
|
47 | 54 |
|
@@ -103,7 +110,12 @@ public Executable configure(String... args) {
|
103 | 110 |
|
104 | 111 | BaseServerOptions serverOptions = new BaseServerOptions(config);
|
105 | 112 |
|
106 |
| - Server<?> server = new NettyServer(serverOptions, sessions); |
| 113 | + Server<?> server = new NettyServer(serverOptions, Route.combine( |
| 114 | + sessions, |
| 115 | + get("/status").to(() -> req -> |
| 116 | + new HttpResponse() |
| 117 | + .addHeader("Content-Type", MediaType.JSON_UTF_8.toString()) |
| 118 | + .setContent(Contents.asJson(ImmutableMap.of("ready", true, "message", "Session map is ready.")))))); |
107 | 119 | server.start();
|
108 | 120 |
|
109 | 121 | BuildInfo info = new BuildInfo();
|
|
0 commit comments