An open API service indexing awesome lists of open source software.

https://github.com/luismanuelamengual/neogroup-httpserver

Simple and fast http server
https://github.com/luismanuelamengual/neogroup-httpserver

fast http server simple

Last synced: about 1 year ago
JSON representation

Simple and fast http server

Awesome Lists containing this project

README

          

![](https://img.shields.io/travis/luismanuelamengual/NeoGroup-HttpServer.svg)
![](https://img.shields.io/github/license/luismanuelamengual/NeoGroup-HttpServer.svg)
![](https://img.shields.io/maven-central/v/com.github.luismanuelamengual/NeoGroup-HttpServer.svg)
![](https://img.shields.io/github/forks/luismanuelamengual/NeoGroup-HttpServer.svg?style=social&label=Fork)
![](https://img.shields.io/github/stars/luismanuelamengual/NeoGroup-HttpServer.svg?style=social&label=Star)
![](https://img.shields.io/github/watchers/luismanuelamengual/NeoGroup-HttpServer.svg?style=social&label=Watch)
![](https://img.shields.io/github/followers/luismanuelamengual.svg?style=social&label=Follow)

# NeoGroup-HttpServer

Fast Open-source HTTP server for modern operating systems. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.

Getting started
---------------

For maven users, just add the following dependency

```xml

com.github.luismanuelamengual
NeoGroup-HttpServer
1.0

```

Examples
---------

Simple "hello world" example of a http server listening at port *80*

```java
package example;

import org.neogroup.httpserver.HttpServer;
import org.neogroup.httpserver.HttpResponse;
import org.neogroup.httpserver.contexts.HttpContext;
import java.util.concurrent.Executors;

public class Main {

public static void main(String[] args) {

HttpServer server = new HttpServer(80);
server.setExecutor(Executors.newCachedThreadPool());
server.addContext(new HttpContext("/test/") {
@Override
public HttpResponse onContext(HttpRequest request) {
HttpResponse response = new HttpResponse();
response.write("Hello world !!");
return response;
}
});
server.start();
}
}
```

Publishing classpath resources and files from a path folder

```java
package example;

import org.neogroup.httpserver.HttpServer;
import org.neogroup.httpserver.HttpResponse;
import org.neogroup.httpserver.contexts.HttpFolderContext;
import java.util.concurrent.Executors;

public class Main {

public static void main(String[] args) {

HttpServer server = new HttpServer(80);
server.setExecutor(Executors.newCachedThreadPool());
server.addContext(new HttpFolderContext("/resources/", "/home/luis/git/myproject/public/"));
server.addContext(new HttpFolderContext("/jar/", "${classPath}/"));
server.start();
}
}
```