Skip to content

Not-for-production experimental java http server using virtual threads

License

Notifications You must be signed in to change notification settings

wmartinmimi/lil-http-server4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lil-http-server4j

An experimental http server for utilising virtual thread features.

IMPORTANT!

Not for production uses!

Example Usage

class Main {
  
  public static void main(String[] args) throws IOException {
    try (var server = new HttpRequestHandler(20000)) {
      server.setHttpRequestListener((request) -> switch (request.path()) {
        case "/hello" -> new HttpResponses.Status200("text/plain-text", "hello");
        case "/bye" -> new HttpResponses.Status204();
        default -> new HttpResponses.Status404("text/plain-text", "404 error");
      });
      server.run();
    }
  }
}

Features

  • Uses Virtual Threads

Testing and Running Requirements

  • JDK version 20+

Importing Requirements

  • org.slf4j library
  • Testing and Running requirements

Development

Testing

./gradlew test

Building

./gradlew build

License

Licensed under MIT License

About

Not-for-production experimental java http server using virtual threads

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages