struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Snowball RC"<>
Subject What is the best way to get all JSON params in custom Interceptor to log them all in a custom logger ?
Date Thu, 23 Mar 2017 10:28:00 GMT

I am trying to implement a custom Interceptor to have a global custom "security" logger in
my web app.

The target is to log all the datas sended to the server during update, save, delete etc...
to have a custom logger for security reasons.

In case of GET and POST (query string param or form data without json object) : 
HttpParameters httpParameters = ActionContext.getContext().getParameters();
works fine.

But in case of json params in POST (request payload) the previous code doesn't works
when the params is serialize via : JSON.stringify(...)

code sample: 
	type: 'POST', 
	url: url, 
	data: JSON.stringify(data),
	dataType: 'json',
	async: false ,
	contentType: 'application/json; charset=utf-8',
	success: function(){
	error: function(data) {
		 if (data.responseText) {
			 var error = JSON.parse(data.responseText);

My custom Interceptor is added at the end of my stack after the json interceptor like this
        <interceptor-ref name="json">
           	<param name="contentType">application/json</param>
       	<interceptor-ref name="commonSecurityLogger"/>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message