Class JakartaServletProcessApplication
- java.lang.Object
-
- org.camunda.bpm.application.AbstractProcessApplication
-
- org.camunda.bpm.application.impl.AbstractServletProcessApplication
-
- org.camunda.bpm.application.impl.JakartaServletProcessApplication
-
- All Implemented Interfaces:
jakarta.servlet.ServletContextListener
,java.util.EventListener
,ProcessApplicationInterface
public class JakartaServletProcessApplication extends AbstractServletProcessApplication implements jakarta.servlet.ServletContextListener
A
AbstractProcessApplication
Implementation to be used in a Servlet container environment.This class implements the
ServletContextListener
interface and can thus participate in the deployment lifecycle of your web application.Usage
In a Servlet 5.0 container it is sufficient adding a custom subclass of
JakartaServletProcessApplication
annotated with@ProcessApplication
to your application:@ProcessApplication("Loan Approval App") public class LoanApprovalApplication extends ServletProcessApplication { // empty implementation }
This, in combination with aMETA-INF/processes.xml
file is sufficient for making sure that the process application class is picked up at runtime.Invocation Semantics
When the
AbstractProcessApplication.execute(java.util.concurrent.Callable)
method is invoked, the servlet process application modifies the context classloader of the current Thread to the classloader that loaded the application-provided subclass of this class. This allows- the process engine to resolve
JavaDelegate
implementations using the classloader of the process application - In apache tomcat this allows you to resolve Naming Resources (JNDI) form the naming context of the process application. JNDI name resolution is based on the TCCL in Apache Tomcat.
Set TCCL of Process Application | | +--------------------+ | |Process Application | invoke v | | ProcessEngine -----------------O--|--> Java Delegate | | | | | +--------------------+
Process Application Reference
The process engine holds a
WeakReference
to theJakartaServletProcessApplication
and does not cache any classes loaded using the Process Application classloader.
-
-
Field Summary
Fields Modifier and Type Field Description protected jakarta.servlet.ServletContext
servletContext
-
Fields inherited from class org.camunda.bpm.application.impl.AbstractServletProcessApplication
processApplicationClassloader, reference, servletContextName, servletContextPath
-
Fields inherited from class org.camunda.bpm.application.AbstractProcessApplication
defaultDeployToEngineName, isDeployed, processApplicationBeanElResolver, processApplicationElResolver, processApplicationScriptEnvironment, variableSerializers
-
-
Constructor Summary
Constructors Constructor Description JakartaServletProcessApplication()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextDestroyed(jakarta.servlet.ServletContextEvent sce)
void
contextInitialized(jakarta.servlet.ServletContextEvent sce)
jakarta.servlet.ServletContext
getServletContext()
protected java.lang.ClassLoader
initProcessApplicationClassloader(jakarta.servlet.ServletContextEvent sce)
-
Methods inherited from class org.camunda.bpm.application.impl.AbstractServletProcessApplication
autodetectProcessApplicationName, getProcessApplicationClassloader, getProperties, getReference
-
Methods inherited from class org.camunda.bpm.application.AbstractProcessApplication
createDeployment, deploy, execute, execute, getBeanElResolver, getDefaultDeployToEngineName, getElResolver, getEnvironmentScripts, getExecutionListener, getName, getProcessApplicationScriptEnvironment, getRawObject, getScriptEngineForName, getTaskListener, getVariableSerializers, initProcessApplicationElResolver, setDefaultDeployToEngineName, setVariableSerializers, undeploy
-
-
-
-
Method Detail
-
contextInitialized
public void contextInitialized(jakarta.servlet.ServletContextEvent sce)
- Specified by:
contextInitialized
in interfacejakarta.servlet.ServletContextListener
-
initProcessApplicationClassloader
protected java.lang.ClassLoader initProcessApplicationClassloader(jakarta.servlet.ServletContextEvent sce)
-
contextDestroyed
public void contextDestroyed(jakarta.servlet.ServletContextEvent sce)
- Specified by:
contextDestroyed
in interfacejakarta.servlet.ServletContextListener
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()
-
-