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

com.networknt.specification.SpecSwaggerUIHandler Maven / Gradle / Ivy


package com.networknt.specification;

import com.networknt.handler.LightHttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.util.HttpString;

/**
 *  Display API Specification in Swagger editor UI
 *
 * @author Gavin Chen
 */
public class SpecSwaggerUIHandler implements LightHttpHandler {

    public SpecSwaggerUIHandler(){}



    @Override
    public void handleRequest(HttpServerExchange exchange) throws Exception {

        exchange.getResponseHeaders().add(new HttpString("Content-Type"), "text/html");
        exchange.getResponseSender().send(getDisplayHtml());
    }

    private String getDisplayHtml() {
        return "\n" +
                "\n" +
                "    OpenAPI Spec\n" +
                "    \n" +
                "\n" +
                "\n" +
                "
\n" + "\n" + "\n" + "\n" + "\n" + ""; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy