Hop Server Servlets
A Hop Server servlet plugin exposes a custom HTTP endpoint on Hop Server.
All built-in remote execution and monitoring endpoints—such as pipeline execution, status checks, metric querying, and stop/pause operations—are implemented as @HopServerServlet plugins.
Implementing a Server Servlet
Annotate the class with @HopServerServlet and extend BaseHttpServlet while implementing IHopServerPlugin:
import org.apache.hop.core.annotations.HopServerServlet;
import org.apache.hop.www.BaseHttpServlet;
import org.apache.hop.www.IHopServerPlugin;
import org.apache.hop.www.PipelineMap;
import org.apache.hop.www.WorkflowMap;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
@HopServerServlet(
id = "customHealthCheck",
name = "Custom Server Health Check Endpoint"
)
public class CustomHealthCheckServlet extends BaseHttpServlet implements IHopServerPlugin {
public static final String CONTEXT_PATH = "/hop/health";
public CustomHealthCheckServlet() {
super();
}
public CustomHealthCheckServlet(PipelineMap pipelineMap, WorkflowMap workflowMap) {
super(pipelineMap, workflowMap);
}
@Override
public String getContextPath() {
return CONTEXT_PATH;
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if (isJettyMode() && !request.getContextPath().startsWith(CONTEXT_PATH)) {
return;
}
response.setContentType("application/json");
response.setStatus(HttpServletResponse.SC_OK);
int runningPipelines = getPipelineMap().getPipelineObjects().size();
int runningWorkflows = getWorkflowMap().getWorkflowObjects().size();
String json = String.format(
"{\"status\":\"UP\",\"activePipelines\":%d,\"activeWorkflows\":%d}",
runningPipelines, runningWorkflows
);
response.getWriter().write(json);
}
}
Key Architectural Rules
-
getContextPath(): Defines the URL mount point under the server root (e.g./hop/health). -
Authentication and Security:
A servlet plugin adds to the attack surface of Hop Server. Hop Server authenticates the caller. What the endpoint returns, and what it does with request parameters, is the plugin’s responsibility. See Security for developers.
Concrete Codebase Examples
-
engine/src/main/java/org/apache/hop/www/GetPipelineStatusServlet.java: Status report endpoint for running pipelines. -
engine/src/main/java/org/apache/hop/www/GetWorkflowStatusServlet.java: Workflow status reporting servlet. -
engine/src/main/java/org/apache/hop/www/PrepareExecutionPipelineServlet.java: Pipeline initialization and execution endpoint.