-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCounters.java
More file actions
42 lines (34 loc) · 1.38 KB
/
Counters.java
File metadata and controls
42 lines (34 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package rsp.app.counters;
import rsp.component.ComponentView;
import rsp.jetty.WebServer;
import rsp.server.StaticResources;
import java.io.File;
/**
* This is a test application for demonstrating this framework's main concepts, usage and test patterns.
* This class illustrates an initial request routing and usage of multiple instances of a component {@link ComponentView}
* some of which are have their state synchronized with a browser's address bar paths and a query parameter and
* one demonstrates how component's state can be cached.
* <p>
* An example test URL: http://localhost:8085/16/-1?c4=27
*/
public final class Counters {
public static final int PORT = 8085;
public final WebServer webServer;
public Counters(final WebServer webServer) {
this.webServer = webServer;
}
public static Counters run(final boolean blockCurrentThread) {
final Counters s = new Counters(new WebServer(PORT,
CountersAppComponent::new,
new StaticResources(new File("src/main/java/rsp/app/counters"),
"/res/")));
s.webServer.start();
if (blockCurrentThread) {
s.webServer.join();
}
return s;
}
static void main(final String[] args) {
run(true);
}
}