Each request in my app goes through the custom interceptor where it validates the sessionid filed value which is passed as the one of the parameters in the request payload(post method).
If it is url paramter then we can use following snippet to catch the parameter.
Map<String, Object> parameters =
actionInvocation.getInvocationContext().getParameters();
String sessionid = parameters.get("sessionId");
What could be the way to catch this parameter in interceptor if "sessionId" being sent as part request payload. I tired below code snippet to catch in the interceptor and it is working fine but in later stages in action classes body is not available to read.if we read twice then request body is not available for the second time to read.
public String intercept(ActionInvocation actionInvocation) throws Exception {
Log.debug(getClass().getName(), "intercept", "Debug enter");
ActionContext context = actionInvocation.getInvocationContext();
HttpServletRequest request = (HttpServletRequest) context.get(HTTP_REQUEST);
RestPostBody restBody= new Gson().fromJson(request.getReader(), RestPostBody.class);
}