Hello there.
I am curious if it would be possible, to implement Flowable as a servlet in a Java application.
My approach is to take the Flowable-UI war file and to start it with an embedded jetty servlet in java.
Currently my code looks like this:
Main method to start jetty:
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
ContextHandler contextHandler = new ContextHandler();
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SECURITY);
context.setContextPath("/");
context.addServlet(new ServletHolder(new ApplicationServlet()), "/*");
server.setHandler(context);
installFlowable(server);
// Start the server
server.start();
server.join();
logger.info("Started server");
}
Method to start Flowable war file:
private static void installFlowable(Server server) throws Exception {
File warFile = new File(
"path-to-flowble-war-file");
if (warFile.exists()) {
HandlerContainer container = (HandlerContainer) server.getHandler();
ContextHandler contextHandler = new ContextHandler(container, "");
WebAppContext context = new WebAppContext();
context.setContextPath("/flowable");
context.setWar(warFile.getAbsolutePath());
contextHandler.setHandler(context);
}
logger.info("flowable work servlet added");
}
When I execute the code, it looks like this:
Does anyone knows, what I am doing wrong?