Till now we have used the jquery AJAX and if we want to catch any parameters in interceptor used to do like below
public String intercept(ActionInvocation actionInvocation) throws Exception {
Map<String, Object> sessionAttributes =
actionInvocation.getInvocationContext().getSession();
Map<String, Object> parameters =
actionInvocation.getInvocationContext().getParameters();
String[] sid = (String[]) parameters.get("sessionId");
}
Now we are making Rest request and all parameters are passing as request body in postman. If we use above code not able to get any parameters which are passed as body in JSON.
struts.xml
<interceptor-ref name="json"></interceptor-ref>
<interceptor-ref name="customSessionInterceptor"></interceptor-ref>
Even if i place json interceptor as first and after my custom interceptor, it is not picking up.
Interceptor class
public class SessionInitInterceptor implements Interceptor {
privtae String sessionId;
//getter and setters
@Override
public String intercept(ActionInvocation actionInvocation) throws
Exception {
//Want to catch sessionid here which is passed from request body
}
}