GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Ktt-Development/simplehttpserver: SimpleHttpServer :: Simplified implementation of the sun http server :: Simplified handlers to execute complex operations

This repository was archived by the owner on Jul 31, 2022. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

410 Commits
410 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
branding
branding
 
 
docs
docs
 
 
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 
settings.xml
settings.xml
 
 

Repository files navigation

 




✨ This library is no longer maintained, try simplehttpserver5. ✨




 


Logo

SimpleHttpServer

Java CI CodeQL Deploy Maven Central version license

A simplified implementation of the sun http server for JDK11.
This library simplifies complex operations for both the server, exchange, and handlers.
Documentation • Issues

Setup

Compiled binaries can be found on Maven Central. Maven Central

For projects built locally, compiled binaries can also be found in releases. releases

Features

📋 Complicated tasks made easy

Simplified exchange methods for:

  • Parsing HTTP GET/POST with multipart/form-data support.
  • Output stream writing with #send.
  • Sending gzip compressed responses.
  • Sending files
SimpleHttpHandler handler = new SimpleHttpHandler(){

    @Override
    public void handle(SimpleHttpExchange exchange){
        Map POST = exchange.getPostMap();

        MultipartFormData form = exchange.getMultipartFormData();
        Record record = form.getRecord("record");
        FileRecord file = (FileRecord) form.getRecord("file");

        exchange.send(new File("OK.png"), true);
    }

};

⭐ Extended Features

Out of the box support for:

  • HTTP Cookies
  • HTTP Sessions
  • Multithreaded Servers
SimpleHttpServer server = new SimpleHttpServer(8080);
server.setHttpSessionHandler(new HttpSessionHandler());

HttpHandler handler = new HttpHandler(){

    @Override
    public void handle(HttpExchange exchange){
        HttpSession session = server.getHttpSession(exchange);
        String session_id = session.getSessionID();

        Map<String,String> cookies = exchange.getCookies();

        exchange.close();
    }

};

💻 Simplified Handlers

Easy to use handlers:

  • Redirect Handler
  • Predicate Handler
  • File Handler
  • Server-Sent-Events Handler
  • Temporary Handler
  • Throttled Handler
RedirectHandler redirect = new RedirectHandler("https://github.com/");

FileHandler fileHandler = new FileHandler();
fileHandler.addFile(new File("index.html"));
fileHandler.addDirectory(new File("/site"))

SSEHandler SSE = new SSEHandler();
SSE.push("Server sent events!");

ThrottledHandler throttled = new ThrottledHandler(new HttpHandler(), new ServerExchangeThrottler())

Contributing

  • Found a bug? Open a new issue.
  • Want to contribute? Create a fork and open a pull request.

About

SimpleHttpServer :: Simplified implementation of the sun http server :: Simplified handlers to execute complex operations

github.com/Ktt-Development/simplehttpserver/tree/main/docs

Topics

http-serverhttpserverjavaktt-developmentliblibrarysimplehttpserver

Resources

Readme
GPL-2.0 license
Activity
Custom properties

Stars

3 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.