eclipse-ee4j / eclipse-ee4j/jersey
@Context annotation declaration of HttpServletReqeuest object in parent reference is passing the first time API hit values to the resource always
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
Hi Team,
We faced a peculiar issue in production and UAT environment, after JBoss server restarting the object reference of the first time hitting to the API, is being passed as input to further request hit to the same API in the same node. We debugged this issue till the jersey core libraries, the request processing context passed to the filters is proper as per the request hit (Stages.process(context, requestProcessingRoot, endpointRef)) whereas at the endpoint invocation line the context is not having the actual request context values instead the first API hit context is always getting passed for all the hits.
Please note the behavior is observed in the certain times when both nodes are running and we restart node by node in some scenarios, also this issue is not reproducible at every time it is randomly but frequently occurring.
Below is the API implementations:
- The parent class which is a common file invoked for all the APIs implemented is having the @Inject HttpServeletRequest reference and used in child classes.
- The first child resource class file which has only abstract methods is having @Context annotated HttpServeletRequest reference object declared.
- The actual resource file which implements the actual API methods, is not having any variable declared for HttpServeletRequest i.e. it is using the reference of first child resource class
ParentClass {
@Inject
protected HttpServletRequest request;
@Inject
protected HttpServletResponse response;
// Has common methods for preauthorize and validation methods
}
FirstChildClass {
@Context protected HttpServletRequest request;
@Context protected HttpServletResponse response;
// Has abstract method declaration and common factory methods for child classes
}
ActualResourceFile{
// No declaration for the HttpServletRequest
@GET
@ApiOperation(value = "Operation description", response = DetailsBean.class, responseContainer = "List")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful retrieval of Details", response = DetailsBean.class,responseContainer="List")
}
)
@MethodInfo(uri=”v1/listdetails”)
public Response fetchDetailsListing(
}
Contributor guide
Assessment
This issue has not been assessed yet.