package jetbrains.buildServer.profile; import java.util.Map; import javax.servlet.http.HttpServletRequest; import jetbrains.buildServer.web.openapi.SimpleWebExtension; import jetbrains.buildServer.web.openapi.WebControllerManager; import jetbrains.buildServer.web.openapi.WebPlace; import org.jetbrains.annotations.NotNull; public class ProfilerWebExtension extends SimpleWebExtension { private final Profiler myProfiler; public ProfilerWebExtension(final WebControllerManager manager, Profiler profiler) { super(manager); myProfiler = profiler; setJspPath("profControls.jsp"); setPlace(WebPlace.ADMIN_SERVER_CONFIGURATION); setPluginName("serverProfile"); setTitle("Server Profiler"); register(); } public boolean isAvailable(@NotNull final HttpServletRequest request) { return myProfiler.isAvailable(); } public void fillModel(final Map model, @NotNull final HttpServletRequest request) { super.fillModel(model, request); Profiler.Mode mode = myProfiler.getMode(); model.put("currentMode", mode.name()); model.put("profilingSettings", myProfiler.getSettings()); } }