Skip to content

GlennnM/Hydar-Web-Server

Repository files navigation

Hydar Web Server

The hydar web server is a custom web server and Java EE implementation developed for embedding in hydar.xyz, another open source project. Please visit the site or view its repository for more information.

Hydar consists of many independent components, as shown in figure 1. The first layer is a custom implementation of an HTTP file server, including support for various HTTP extensions such as caching, partial downloads, compression, and a custom implementation of HTTP/2.0, supporting server-sided events. It also fully supports encrypted sessions using the builtin Java implementation of TLSv1.3. Under default configurations, files will be reloaded periodically through a low overhead watch service, and static files under 1MB will be cached in memory.

The next layer is the custom JSP compiler and Java EE implementation for servlet code, built upon the Hydar HTTP server, allowing for dynamic webapps which are generally compatible with other servlet containers. The servlet code may be compiled completely in memory and no reflection is needed for responding to the requests after compilation. This additionally allows for authenticated WebSocket sessions that can dynamically dispatch servlet requests, and support for sessions in environments without cookies. For a full list of the implemented Java EE APIs and how to set up your own HydarEE app, see the javadoc(soon)

This package also includes custom JDBC connection and statement pooling, which ensures prepared statements are closed properly and connections are reused, and is loaded through JNDI similarly to in other servlet containers(xyz.hydar.ee.HydarDataSource). Finally, Hydar can optionally rate limit expensive servlet code through the HydarLimiter API.

Building

Clone the repository and run compile_hydar.bat or compile_hydar.sh(JDK 17+ required). This will launch the example server on port 8080, and you can view its source in /src/webapp/, or configure it in hydar.properties.
The command line arguments supplied are paths to "hydar.properties" files, each of which will launch a servlet. Servlets are separated by the Hydar.HOST and Hydar.SERVLET_PATH properties in the file, and the files hosted are determined by the Hydar.WEB_ROOT property. The web root path is relative to the hydar.properties file for that servlet.
More documentation might be available eventually.
There are no dependencies.