Skip to content

Commit e21d0ea

Browse files
committed
Replacing Grizzly with lightweight HTTP server
1 parent 3ce4a3c commit e21d0ea

File tree

6 files changed

+724
-5
lines changed

6 files changed

+724
-5
lines changed

browser/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
<groupId>org.glassfish.grizzly</groupId>
9494
<artifactId>grizzly-http-server</artifactId>
9595
<version>2.3.19</version>
96+
<scope>provided</scope>
9697
</dependency>
9798
<dependency>
9899
<groupId>org.netbeans.html</groupId>

browser/src/main/java/org/netbeans/html/presenters/browser/Browser.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ public final class Browser implements Fn.Presenter, Fn.KeepAlive, Flushable,
9797
* If the property is not specified the system tries <b>GTK</b> mode first,
9898
* followed by <b>AWT</b> and then tries to execute <code>xdg-open</code>
9999
* (default LINUX command to launch a browser from a shell script).
100+
* <p>
101+
* In addition to the above properties, it is possible to also enable
102+
* debugging by setting <code>com.dukescript.presenters.browserDebug=true</code>.
100103
*/
101104
public Browser() {
102105
this(new Config());
@@ -112,7 +115,7 @@ public Browser(Config config) {
112115
}
113116

114117
Browser(String app, Config config, Supplier<HttpServer<?,?,?, ?>> serverProvider) {
115-
this.serverProvider = serverProvider != null ? serverProvider : GrizzlyServer::new;
118+
this.serverProvider = serverProvider != null ? serverProvider : SimpleServer::new;
116119
this.app = app;
117120
this.config = new Config(config);
118121
}
@@ -216,7 +219,7 @@ static <T extends Exception> T raise(Class<T> aClass, Exception ex) throws T {
216219
public final static class Config {
217220
private Consumer<URI> browser;
218221
Integer port;
219-
boolean debug;
222+
boolean debug = Boolean.getBoolean("com.dukescript.presenters.browserDebug");
220223

221224
/**
222225
* Default constructor.
@@ -306,7 +309,7 @@ public Config port(int port) {
306309
* @return this instance
307310
* @since 1.8
308311
*/
309-
Config debug(boolean debug) {
312+
public Config debug(boolean debug) {
310313
this.debug = debug;
311314
return this;
312315
}

0 commit comments

Comments
 (0)