Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions browser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<groupId>org.glassfish.grizzly</groupId>
<artifactId>grizzly-http-server</artifactId>
<version>2.3.19</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.netbeans.html</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
* &lt;version&gt;<a target="blank" href="http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.dukescript.presenters%22%20AND%20a%3A%22browser%22">1.x</a>&lt;/version&gt;
* &lt;/dependency&gt;
* </pre>
*
* Since 1.8.2 version this presenter uses lightweight HTTP server
* implementation that eliminates the need for Grizzly dependencies.
* A <em>compatibility mode</em> can be turned on by including the
* <code>org.glassfish.grizzly:grizzly-http-server:2.3.19</code>
* dependency during execution - see
* <a target="_blank" href="https://github.com/apache/netbeans-html4j/pull/26">PR-26</a> for more details.
*/
@ServiceProvider(service = Presenter.class)
public final class Browser implements Fn.Presenter, Fn.KeepAlive, Flushable,
Expand Down Expand Up @@ -97,6 +104,9 @@ public final class Browser implements Fn.Presenter, Fn.KeepAlive, Flushable,
* If the property is not specified the system tries <b>GTK</b> mode first,
* followed by <b>AWT</b> and then tries to execute <code>xdg-open</code>
* (default LINUX command to launch a browser from a shell script).
* <p>
* In addition to the above properties, it is possible to also enable
* debugging by setting <code>com.dukescript.presenters.browserDebug=true</code>.
*/
public Browser() {
this(new Config());
Expand All @@ -112,7 +122,7 @@ public Browser(Config config) {
}

Browser(String app, Config config, Supplier<HttpServer<?,?,?, ?>> serverProvider) {
this.serverProvider = serverProvider != null ? serverProvider : GrizzlyServer::new;
this.serverProvider = serverProvider != null ? serverProvider : SimpleServer::new;
Copy link
Contributor Author

@jtulach jtulach Mar 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default selects SimpleServer - change to GrizzlyServer to try that one. Plus, as pointed by Matthias, one has to add Grizzly on classpath - currently the grizzly modules only available for compilation & tests - e.g. the provided scope.

this.app = app;
this.config = new Config(config);
}
Expand Down Expand Up @@ -216,7 +226,7 @@ static <T extends Exception> T raise(Class<T> aClass, Exception ex) throws T {
public final static class Config {
private Consumer<URI> browser;
Integer port;
boolean debug;
boolean debug = Boolean.getBoolean("com.dukescript.presenters.browserDebug");

/**
* Default constructor.
Expand Down Expand Up @@ -306,7 +316,7 @@ public Config port(int port) {
* @return this instance
* @since 1.8
*/
Config debug(boolean debug) {
public Config debug(boolean debug) {
this.debug = debug;
return this;
}
Expand Down
Loading