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

com.guicedee.guicedservlets.swagger.OpenAPIModule Maven / Gradle / Ivy

There is a newer version: 1.2.2.1-jre17
Show newest version
package com.guicedee.guicedservlets.swagger;

import com.guicedee.guicedservlets.services.GuiceSiteInjectorModule;
import com.guicedee.guicedservlets.services.IGuiceSiteBinder;
import com.guicedee.guicedservlets.swagger.implementations.SwaggerServlet;

import java.util.HashMap;
import java.util.Map;

public class OpenAPIModule
		implements IGuiceSiteBinder
{
	private static String path = "/openapi";

	public OpenAPIModule()
	{
		//Not required
	}

	public OpenAPIModule(final String path)
	{
		this.path = path;
	}

	public static String getPath()
	{
		return path;
	}

	public static void setPath(String path)
	{
		OpenAPIModule.path = path;
	}

	@Override
	public void onBind(GuiceSiteInjectorModule module)
	{
		Map props = new HashMap<>();
		props.put("jersey.config.server.wadl.disableWadl", "true");
		props.put("jersey.config.server.provider.packages", "");
		module.serve$(path + "/*")
		      .with(SwaggerServlet.class, props);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy