Annotation Type SRA
-
@Inherited @InterceptorBinding @Retention(RUNTIME) @Target({TYPE,METHOD}) public @interface SRA
An annotation for controlling the lifecycle of Short Running Actions (SRAs). Newly created SRAs are uniquely identified and the id is referred to as the SRA context. The context is passed around using a JAX-RS request/response header called SRAClient#SRA_HTTP_HEADER ("Short-Running-Action"). The implementation (of the SRA specification) is expected to manage this context and the application developer is expected to declaratively control the creation, propagation and destruction of SRAs using the @SRA annotation. When a JAX-RS bean method is invoked in the context of an SRA any JAX-RS client requests that it performs will carry the same header so that the receiving resource knows that it is inside an SRA context (typically achieved using JAX-RS client filters). Similarly if theenableJTABridge()attribute is enabled then a JTA transaction context will be associated for the duration of the method call so that any resources used by the method will be enlisted with the SRA and will be committed or rolled back when the SRA finishes. Resource methods can access the context id, if required, by injecting it via the JAX-RS @HeaderParam annotation or via theSRAClientAPI. This may be useful, for example, for associating business work with an SRA.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description javax.ws.rs.core.Response.Status[]cancelOnThe cancelOn element can be set to indicate which HTTP response codes will cause the SRA to canceljavax.ws.rs.core.Response.Status.Family[]cancelOnFamilyThe cancelOnFamily element can be set to indicate which families of HTTP response codes will cause the SRA to cancel.booleanenableJTABridgeCreate a local JTA transaction context such that existing transactional JavaEE code may be called within the scope of the SRA.booleanendNormally if an SRA is present when a bean method is invoked it will not be ended when the method returns.SRA.TypevalueThe Type element of the SRA annotation indicates whether a bean method is to be executed within the context of a SRA.
-
-
-
Element Detail
-
value
SRA.Type value
The Type element of the SRA annotation indicates whether a bean method is to be executed within the context of a SRA.- Default:
- org.jboss.jbossts.star.annotation.SRA.Type.REQUIRED
-
-
-
enableJTABridge
boolean enableJTABridge
Create a local JTA transaction context such that existing transactional JavaEE code may be called within the scope of the SRA. This enables JTA resources to participate in the SRA and will be committed or rolled back when the SRA finishes.- Returns:
- whether or not JTA bridging is enabled
- Default:
- false
-
-
-
end
boolean end
Normally if an SRA is present when a bean method is invoked it will not be ended when the method returns. To override this behaviour use the end element to force its termination- Returns:
- true if an SRA that was present before method execution will be closed when the bean method finishes.
- Default:
- true
-
-
-
cancelOnFamily
javax.ws.rs.core.Response.Status.Family[] cancelOnFamily
The cancelOnFamily element can be set to indicate which families of HTTP response codes will cause the SRA to cancel. By default client errors (4xx codes) and server errors (5xx codes) will result in cancellation of the SRA.- Returns:
- the
Response.Status.Familyfamilies that will cause cancellation of the SRA
- Default:
- {javax.ws.rs.core.Response.Status.Family.CLIENT_ERROR, javax.ws.rs.core.Response.Status.Family.SERVER_ERROR}
-
-