Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing Grizzly with lightweight HTTP server #26

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6cf8cc4
Abstracting away dependency on Grizzly HTTP server
jtulach Feb 22, 2020
7fe213d
Implementing simple HTTP server from scratch
jtulach Feb 23, 2020
f8462d0
Using server provider factory
jtulach Feb 23, 2020
717f4e1
Consistent implementation of getRequestURI for both servers
jtulach Feb 23, 2020
cf1ca6b
Consistent access to request parameters
jtulach Feb 23, 2020
2223e8e
Content-Type, encoding, server name and server port
jtulach Feb 23, 2020
933ff41
Passing thru the CORS attributes
jtulach Feb 23, 2020
00376a9
Recognizing GET and HEAD methods
jtulach Feb 23, 2020
da7300a
Proper implementation of getReader(request)
jtulach Feb 23, 2020
3736820
Support for suspend/resume of a request
jtulach Feb 23, 2020
2cc1db0
Initialization finishes in other thread and has to suspend the request
jtulach Feb 24, 2020
ee79b72
close the writer and close the stream when data are dumped
jtulach Feb 24, 2020
96f4e98
Running the BrowserTest with both server implementations
jtulach Feb 24, 2020
f6d0a56
Using the unified ServerFactories infrastructure
jtulach Feb 24, 2020
5b4526f
Moving @JavaScriptBody methods into own class
jtulach Feb 24, 2020
825a4f6
Compile on JDK11 and run on JDK8
jtulach Feb 24, 2020
aa97abc
Transfer parameters in the body of the request
jtulach Feb 29, 2020
da74643
Ready to receive long request body
jtulach Feb 29, 2020
7016151
Sort the registered handlers from longest to shorter, more generic
jtulach Feb 29, 2020
6d02c0f
Return correct method name
jtulach Feb 29, 2020
fa8b1f1
Cannot cache Fn objects when running in multiple contexts
jtulach Feb 29, 2020
70bf13a
Merge remote-tracking branch 'origin/master' into AnyHttpServer
jtulach Feb 29, 2020
7ba2868
Making Simple server the default
jtulach Feb 29, 2020
5f02bdf
Display currently running test name
jtulach Mar 2, 2020
f0fb3cc
Using Files.probeContentType to find right MIME type for JavaScript a…
jtulach Mar 7, 2020
6d000e1
Proper handling of HTTP status code
jtulach Mar 7, 2020
9923de8
Removing unnecessary abstractions
jtulach Mar 8, 2020
bbc6b87
Unify request and response object
jtulach Mar 8, 2020
e30f5fc
Suspend writing operations when the request is suspended
jtulach Mar 21, 2020
1bfa138
Debugging mode has to be requested explicitly in the Browser.Config
jtulach Mar 21, 2020
3a1d777
Let the HttpServer handle the dispatch of Runnables
jtulach Mar 21, 2020
812e889
Capture the initialization protocol and print it out in case of failure
jtulach Mar 22, 2020
9c1c5f6
Moving the JavaScriptBody methods to utilities class
jtulach Mar 22, 2020
d3befb4
Merge remote-tracking branch 'origin/master' into AnyHttpServer
jtulach Mar 22, 2020
eea8f75
Merge branch 'AnyHttpServer' of https://github.com/jtulach/netbeans-h…
jtulach Mar 22, 2020
d71c967
No need for language parser
jtulach Mar 22, 2020
dfb2de8
Grizzly doesn't work with Internet Explorer 11 - simple server does
jtulach Mar 22, 2020
aec744a
Match both: text/javascript as well as application/javascript
jtulach Mar 22, 2020
64bc0c4
Merging with most recent changes
jtulach Sep 18, 2021
531c6e9
Support OPTIONS method
jtulach Sep 18, 2021
d8387e0
Better synchronization of the simple server
jtulach Sep 18, 2021
e47a369
Parse even bogus URL parameters
jtulach Sep 21, 2021
821be96
Removing useless @throws tag
jtulach Nov 29, 2021
d2d8501
Response characters are uniformly converted to bytes in US-ASCII enco…
jtulach Dec 9, 2021
e528510
Use URLDecoder to parse the % signs in URLs
jtulach Dec 9, 2021
84a0761
Merge remote-tracking branch 'origin/master' into AnyHttpServer
jtulach Dec 9, 2021
9bc1429
Allow the random number generator to be specified externally
jtulach Dec 9, 2021
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 @@ -97,6 +97,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 +115,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 +219,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 +309,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