Seeing the http request in wicket

梦想与她 提交于 2019-12-06 11:02:13

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();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!