Skip to content

Easy to use embedded HTTP(S) web server you can build into your application. Also brings a static file server and a simple HTTP(S) reverse proxy with prebuilt ready to user docker images.

License

Notifications You must be signed in to change notification settings

d3adspace/mantikor

Repository files navigation

Mantikor

Mantikor

Mantikor is a simple and lightweight webserver designed to build it into your own application as an embedded webserver to handle handle web interfaces or similar shit. If you want to build RESTful services better take a look at https://github.com/D3adspaceEnterprises/echidna

Build Status

Build Status
Master Build Status
Development Build Status

Installation / Usage

  • Clone this repo
  • Install: ./gradlew build

Maven repositories

<repositories>
    <repository>
        <id>klauke-enterprises-maven-releases</id>
        <name>Klauke Enterprises Maven Releases</name>
        <url>https://repository.klauke-enterprises.com/repository/maven-releases/</url>
    </repository>

    <repository>
        <id>klauke-enterprises-maven-snapshots</id>
        <name>Klauke Enterprises Maven Snapshots</name>
        <url>https://repository.klauke-enterprises.com/repository/maven-snapshots/</url>
    </repository>
</repositories>

Maven dependencies

Server:

<dependency>
    <groupId>de.d3adspace.mantikor</groupId>
    <artifactId>mantikor-server</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

HTTP Models:

<dependency>
    <groupId>de.d3adspace.mantikor</groupId>
    <artifactId>mantikor-commons</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Netty channel handler implementations:

<dependency>
    <groupId>de.d3adspace.mantikor</groupId>
    <artifactId>mantikor-codec-netty</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Gradle repositories:

maven {
    url = 'https://repository.klauke-enterprises.com/repository/maven-releases/'
}

maven {
    url = 'https://repository.klauke-enterprises.com/repository/maven-snapshots/'
}

Gradle dependencies:

Server:

dependencies {
    compile 'de.d3adspace.mantikor:mantikor-server:1.0-SNAPSHOT'
}

Commons:

dependencies {
    compile 'de.d3adspace.mantikor:mantikor-commons:1.0-SNAPSHOT'
}

Netty channel handler implementations:

dependencies {
    compile 'de.d3adspace.mantikor:mantikor-codec-netty:1.0-SNAPSHOT'
}

Example

Build an HTTP request

HTTPRequest request = HTTPRequest.newBuilder()
    .withMethod(HTTPMethod.GET)
    .withLocation("/test")
    .withHeader("Authorization", "3456-6543-4566-2342")
    .build();

Build an HTTP response

HTTPResponse response = HTTPResponse.newBuilder()
    .withStatus(HTTPStatus.OK)
    .withHeader("X-Powered-By", "Me")
    .withBody("NOPE!")
    .build();

Create a custom server

MantikorConfig mantikorConfig = MantikorConfig.newBuilder()
	.setServerHost("localhost")
	.setServerPort(8080)
	.createMantikorConfig();
		
MantikorServer mantikorServer = new MantikorServer(mantikorConfig) {
	@Override
	public HTTPResponse handleRequest(HTTPRequest request) {
	  return HTTPResponse.newBuilder()
          .withStatus(HTTPStatus.OK)
          .withHeader("X-Powered-By", "Me")
          .withBody("NOPE!")
          .build();
	}
};
		
mantikorServer.start();

File Server

We deliver a really simple example of a static file server located at file-server. It can serve local files really fast. The preferred way of deployment is via Docker:

docker run -it -v /home/user:/opt/base d3adspace/mantikor-file-server

For docker-compose, take a look at docker-compose.yml

About

Easy to use embedded HTTP(S) web server you can build into your application. Also brings a static file server and a simple HTTP(S) reverse proxy with prebuilt ready to user docker images.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •