Class ContextServiceDefinitionServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
ee.jakarta.tck.concurrent.framework.TestServlet
ee.jakarta.tck.concurrent.spec.ContextService.contextPropagate.ContextServiceDefinitionServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
@WebServlet("/ContextServiceDefinitionServlet")
public class ContextServiceDefinitionServlet
extends TestServlet
- See Also:
-
Field Summary
Fields inherited from class ee.jakarta.tck.concurrent.framework.TestServlet
FAILURE, nl, SUCCESS, TEST_METHOD
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
before()
Override to mimic JUnit's@Before
annotation.void
destroy()
void
A ContextServiceDefinition with all attributes configured propagates/clears/ignores context types as configured.void
A ContextServiceDefinition with minimal attributes configured clears transaction context and propagates other types.void
A ContextServiceDefinition can specify a third-party context type to be propagated/cleared/ignored.void
A ContextService contextualizes a Consumer, which can be supplied as a dependent stage action to an unmanaged CompletableFuture.void
A ContextService contextualizes a Flow.Processor, which is subscribed to an unmanaged Flow.Producer.void
A ContextService contextualizes a Flow.Subscriber, which is subscribed to an unmanaged Flow.Producer.void
A ContextService contextualizes a Function, which can be supplied as a dependent stage action to an unmanaged CompletableFuture.void
A ContextService contextualizes a Supplier, which can be supplied as a dependent stage action to an unmanaged CompletableFuture.void
ContextService can create a contextualized copy of an unmanaged CompletableFuture.Methods inherited from class ee.jakarta.tck.concurrent.framework.TestServlet
after, beforeClass, doGet, doPost, getResponse, invokeTest, sendPostData
Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPatch, doPut, doTrace, getLastModified, init, isSensitiveHeader, service, service
Methods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
ContextServiceDefinitionServlet
public ContextServiceDefinitionServlet()
-
-
Method Details
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Servlet
- Overrides:
destroy
in classjakarta.servlet.GenericServlet
-
before
public void before() throws jakarta.servlet.ServletExceptionDescription copied from class:TestServlet
Override to mimic JUnit's@Before
annotation.- Overrides:
before
in classTestServlet
- Throws:
jakarta.servlet.ServletException
-
testContextServiceDefinitionAllAttributes
A ContextServiceDefinition with all attributes configured propagates/clears/ignores context types as configured. ContextA, which is tested here, propagates Application context and IntContext, clears StringContext, and leaves Transaction context unchanged.- Throws:
Throwable
-
testContextServiceDefinitionDefaults
A ContextServiceDefinition with minimal attributes configured clears transaction context and propagates other types.- Throws:
Throwable
-
testContextServiceDefinitionWithThirdPartyContext
A ContextServiceDefinition can specify a third-party context type to be propagated/cleared/ignored. This test uses 2 ContextServiceDefinitions: ContextA with IntContext propagated and StringContext cleared. ContextB with IntContext unchanged and StringContext propagated (per ALL_REMAINING).- Throws:
Throwable
-
testContextualConsumer
A ContextService contextualizes a Consumer, which can be supplied as a dependent stage action to an unmanaged CompletableFuture. The dependent stage action runs with the thread context of the thread that contextualizes the Consumer, per the configuration of the ContextServiceDefinition.- Throws:
Throwable
-
testContextualFunction
A ContextService contextualizes a Function, which can be supplied as a dependent stage action to an unmanaged CompletableFuture. The dependent stage action runs with the thread context of the thread that contextualizes the Function, per the configuration of the ContextServiceDefinition.- Throws:
Throwable
-
testContextualSupplier
A ContextService contextualizes a Supplier, which can be supplied as a dependent stage action to an unmanaged CompletableFuture. The dependent stage action runs with the thread context of the thread that contextualizes the Supplier, per the configuration of the ContextServiceDefinition.- Throws:
Throwable
-
testContextualFlowSubscriber
A ContextService contextualizes a Flow.Subscriber, which is subscribed to an unmanaged Flow.Producer. The Flow.Subscriber methods are run with the thread context of the thread which contextualizes the Flow.Subscriber per the configuration of the ContextServiceDefinition. publisher.subscribe triggers onSubscribe publisher.offer triggers onNext publisher.close (implicit from AutoClosable) triggers onComplete publisher.closeExceptionally triggers onError- Throws:
Throwable
-
testContextualFlowProcessor
A ContextService contextualizes a Flow.Processor, which is subscribed to an unmanaged Flow.Producer. The Flow.Subscriber methods are run with the thread context of the thread which contextualizes the Flow.Processor per the configuration of the ContextServiceDefinition. processor.subscribe triggers subscribe publisher.subscribe triggers onSubscribe publisher.offer triggers onNext publisher.close (implicit from AutoClosable) triggers onComplete publisher.closeExceptionally triggers onError- Throws:
Throwable
-
testCopyWithContextCapture
ContextService can create a contextualized copy of an unmanaged CompletableFuture.- Throws:
Throwable
-