Hi. First I apologize if this is a naive question.
I’ve been asked to look into the possibility of deploying a simple File Validation service with Camunda, ideally as a servlet that sits with Camunda. A colleague has been working on a BPMN workflow, which we build and deploy as a ServletProcessApplication WAR and it works great.
The issue we ran into, is during the new Task creation step we need to accept a CSV file which is intended to be the definition against which other files submitted using the task workflow will be referenced against. We’re very concerned that that submitted CSV file could be invalid or simply not a CSV file. This is an existing file that the manual process already works with and we can’t change that process just yet, so we have to with it.
A simple solution is to just write a servlet that accepts a basic POST request, validates the file every which way, then responds with 200, or 500 with an appropriate error message. The new task form we have can post the file to the servlet via a JS call, then if the form is good/bad, display the acceptance before the user can click the submit button and the task gets created.
I wrote a simple servlet to test if I could just access it. I copied the war to the camunda /webapps directory, it was deployed and the logs show as much, but I can’t access the webservlet URL: http://127.0.0.1:8080/testo/csv. I realize that would be the correct URL, but I’m not sure where it would be hosted under. Should I be adding a to the server.xml configuration?
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/testo/csv")
public class CsvValidator extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/plain");
resp.getWriter().write("Hello World! Maven Web Project Example.");
}
}
I figured I just ask a dumb question out wright instead of trying to guess. Any help is greatly appreciated. Thanks.