在wicket中查看http请求 [英] Seeing the http request in wicket

查看:207
本文介绍了在wicket中查看http请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Apache Wicket,我希望看到http请求本身(请求的确切文本,无需任何处理!)。我该怎么办?

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?

谢谢

推荐答案

在Wicket 1.4中,您可以使用以下代码获取 HttpServletRequest 对象(这是请求的servlet表示,您可以获得最多):

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();

然而,没有任何处理部分将无法工作有两个原因:servlet引擎本身将做一些处理(比如解码url参数),Wicket将使用包含请求实体的输入流。

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.

这篇关于在wicket中查看http请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆