I'm using Apache Wicket and I want to see the http request itself (Exact text of the request without any processing!). What should I do?
Thanks
In Wicket 1.4, you can get the HttpServletRequest
object (which is the servlet representation of the request, the rawest you can get) with this code:
HttpServletRequest req = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest();
However, the "without any processing" part will not work for two reasons: the servlet engine itself will do some processing (like decoding url parameters) and Wicket will have consumed the input stream containing the request entity.
If you want to monitor the raw requests, you have to intercept it on the webserver level.
For Wicket 1.5 you can get the underlying request object and cast it to HttpServletRequest:
HttpServletRequest request = ((HttpServletRequest) getRequest().getContainerRequest());
final Request request = RequestCycle.get().getRequest();
来源:https://stackoverflow.com/questions/10983293/seeing-the-http-request-in-wicket