Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amayaframework/sun-http-server
A repackaged and refactored sun http server, created in the original form by Oracle and formerly embedded in the jdk. Distributed under the GNU v2 license.
https://github.com/amayaframework/sun-http-server
http http-server https https-server java java-8 java-library java-nio java-server nonblocking-sockets sun sun-server
Last synced: about 1 month ago
JSON representation
A repackaged and refactored sun http server, created in the original form by Oracle and formerly embedded in the jdk. Distributed under the GNU v2 license.
- Host: GitHub
- URL: https://github.com/amayaframework/sun-http-server
- Owner: AmayaFramework
- License: gpl-2.0
- Created: 2022-01-03T17:42:21.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-09T21:30:11.000Z (10 months ago)
- Last Synced: 2024-03-09T22:27:43.989Z (10 months ago)
- Topics: http, http-server, https, https-server, java, java-8, java-library, java-nio, java-server, nonblocking-sockets, sun, sun-server
- Language: Java
- Homepage:
- Size: 133 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# sun-http-server [![maven-central](https://img.shields.io/maven-central/v/io.github.amayaframework/http-server?color=blue)](https://repo1.maven.org/maven2/io/github/amayaframework/http-server/)
A repackaged and refactored sun http server, created in the original form by Oracle and formerly embedded in the jdk.
Distributed under the GNU v2 license.This server, built on non-blocking sockets, is a really good lightweight solution that has everything you need
for full use in various projects. Up to this point, it was ignored by most of the community due to its location
in sun packages. Now this restriction has been removed.## Getting Started
To install it, you will need:
* Java 8+
* SLF4J implementation (optional)
* Maven/Gradle## Installing
### Gradle dependency
```Groovy
dependencies {
implementation group: 'io.github.amayaframework', name: 'http-server', version: 'LATEST'
}
```### Maven dependency
```
io.github.amayaframework
http-server
LATEST```
## Usage example
The code below will start the server associated with the address localhost:8000.
There will be one handler on the server responding to a route starting with /hello.
The response will contain code 200 and an empty body.
He will respond to all other requests with the code 404.```Java
public class Server {
public static void main(String[] args) throws IOException {
HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0);
server.createContext("/hello", exchange -> {
exchange.sendResponseHeaders(HttpCode.OK, 0);
exchange.close();
});
server.start();
}
}
```## Built With
* [Gradle](https://gradle.org) - Dependency management
* [slf4j](https://www.slf4j.org) - Logging facade## Authors
* [Oracle Corporation](https://www.oracle.com) - *Main work*
* [RomanQed](https://github.com/RomanQed) - *Repackaging and refactoring*See also the list of [contributors](https://github.com/AmayaFramework/sun-http-server/contributors) who participated in
this project.## License
This project is licensed under the GNU GENERAL PUBLIC LICENSE Version 2 - see the [LICENSE](LICENSE) file for details
Also, according to the requirements, the original inserts of Oracle
license headers are preserved in the original source files.## Acknowledgments
Thanks to all the sun developers who participated in the creation of this server.