package geniusweb.partiesserver; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import geniusweb.partiesserver.repository.RunningPartiesRepo; import geniusweb.serverobjects.ServerInfo; /** * Servlet implementation to get general info from the server. */ public class Info extends HttpServlet { private final static RunningPartiesRepo repo = RunningPartiesRepo .instance(); /** * see * {@link HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)}. * Returns to the http caller * */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append(Constants.getJackson().writeValueAsString( new ServerInfo(repo.availableSlots(), repo.maximumSlots()))); } }