Play Framework 2.8 with Java reading body in filter

Hi All,

I wanted to create a filter which will mirror traffic to some other server as well, for that thinking of writing a filter which will capture these request and forward it to another URL and then pass through for normal processing. However, I didn’t found any good documentation on reading body in filters. Is there a easy way we can read POST body in filter?

Thanks.
Regards,
Anant

I think instead of a filter, what you are looking for is an ActionCreator like this:

import java.lang.reflect.Method;

import play.http.DefaultActionCreator;
import play.mvc.Action;
import play.mvc.Http;

public class Test extends DefaultActionCreator {

	@Override
	public Action<?> createAction(Http.Request request, Method actionMethod) {
		request.body(); // there you go
		return super.createAction(request, actionMethod);
	}

}