simplehttpserver

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

Лицензия

Лицензия

Группа

Группа

com.kttdevelopment
Идентификатор

Идентификатор

simplehttpserver
Последняя версия

Последняя версия

4.4.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

simplehttpserver
📕 SimpleHttpServer :: Simplified implementation of the sun http server :: Simplified handlers to execute complex operations
Ссылка на сайт

Ссылка на сайт

https://github.com/Ktt-Development/simplehttpserver
Система контроля версий

Система контроля версий

https://github.com/Ktt-Development/simplehttpserver.git

Скачать simplehttpserver

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.kttdevelopment/simplehttpserver/ -->
<dependency>
    <groupId>com.kttdevelopment</groupId>
    <artifactId>simplehttpserver</artifactId>
    <version>4.4.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.kttdevelopment/simplehttpserver/
implementation 'com.kttdevelopment:simplehttpserver:4.4.2'
// https://jarcasting.com/artifacts/com.kttdevelopment/simplehttpserver/
implementation ("com.kttdevelopment:simplehttpserver:4.4.2")
'com.kttdevelopment:simplehttpserver:jar:4.4.2'
<dependency org="com.kttdevelopment" name="simplehttpserver" rev="4.4.2">
  <artifact name="simplehttpserver" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.kttdevelopment', module='simplehttpserver', version='4.4.2')
)
libraryDependencies += "com.kttdevelopment" % "simplehttpserver" % "4.4.2"
[com.kttdevelopment/simplehttpserver "4.4.2"]

Зависимости

test (2)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-api jar 5.7.0
org.junit.jupiter : junit-jupiter-params jar 5.7.0

Модули Проекта

Данный проект не имеет модулей.

Logo

SimpleHttpServer

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

Deploy Java CI Maven Central version license

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())
com.kttdevelopment

Ktt Development

Applications & Libraries designed for deployment. Supported by @Katsute

Версии библиотеки

Версия
4.4.2
4.4.1
4.4.0
4.3.0
4.2.0
4.1.0
4.0.0
03.06.05