拦截并过滤HTTP请求 [英] Intercept and filter HTTP request

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

问题描述

我想拦截/嗅探传入的HTTP请求并过滤/修改其内容(在它们到达应用程序之前).

I want to intercept/sniff incoming HTTP request and filter/modify their contents (before they reach the application).

提琴手"似乎具有此功能,但是出于集成和可移植性的考虑,我宁愿在Java/C中使用一些库来执行此操作.例如,像JPCAP.它拦截IP数据包,但是如上所述,我需要拦截-更高级别的HTTP请求.

"Fiddler" seems to have this functionality, but for the sake of integration and portability I would rather have some library in Java/C to do this. Like JPCAP, for example. It intercepts IP packets, but, as stated, I need to intercept the -higher level- HTTP requests.

此外,如何以相同的方式读取/修改SSL加密(HTTPS)请求?

Furthermore, how can SSL encrypted (HTTPS) requests be read/modified in the same way?

谢谢.

推荐答案

您是否尝试过 Servlet过滤器?

它们包装HTTP请求,因此可以在请求到达servlet之前对其进行修改,并且还可以修改响应.它们可以(并且)用于包装第三方servlet和JSP.

They wrap the HTTP request and so can modify the request before it gets to the servlet, and can modify the response as well. They can (and are) used to wrap third-party servlets and JSPs.

由于它们位于servlet容器中,因此您可以安全地对请求和响应进行未加密的访问.

Because they are in the servlet container, you have secure, unencrypted access to both the request and response.

这篇关于拦截并过滤HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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