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

ca.ibodrov.mica.server.ui.SwaggerServlet Maven / Gradle / Ivy

There is a newer version: 0.0.25
Show newest version
package ca.ibodrov.mica.server.ui;

import com.google.common.io.ByteStreams;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/api/mica/swagger.json")
public class SwaggerServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        resp.setStatus(200);
        resp.setHeader("Content-Type", "application/json");
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        var in = cl.getResourceAsStream("ca/ibodrov/mica/server/swagger/swagger.json");
        assert in != null;
        ByteStreams.copy(in, resp.getOutputStream());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy