All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.simple4j.javalinpojoashttp.JavalinHTTPExposer Maven / Gradle / Ivy

Go to download

This is aa addon library to WSFeeler for projects using Javalin and need to expose beans in application conext as HTTP interface for testing.

The newest version!
package org.simple4j.javalinpojoashttp;

import org.simple4j.wsfeeler.pojoashttp.HTTPExposer;
import org.springframework.context.ApplicationContext;

import io.javalin.Javalin;

public class JavalinHTTPExposer extends HTTPExposer
{

	public JavalinHTTPExposer(ApplicationContext context)
	{
		super(context);
	}

	@Override
	public void expose()
	{
		Javalin javalin = Javalin.create();

        javalin.post(this.getUrlBase()+"/request.json", ctx -> 
        {
            String bodyJson = ctx.body();
            ctx.result(processRequest(bodyJson));
        });
        
        javalin.start(this.getListenerPortNumber());

	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy