开发者

Is it possible to get the raw request of HttpExchange?

开发者_如何学Python

How can I get the raw request from com.sun.net.httpserver.HttpExchange?

I'm using HttpServer to make a proxy, so I want to get the raw http request and send it to the original host.


The HttpExchange API does not support this. You are (of course) free to create your own class that extends HttpExchange and implements its methods however you want. (The class is really just a set of abstract methods.)

The only other possibility would be to look at some existing implementation of HttpExchange in the Sun/Oracle codebase.

  • My intuition of how HttpExchange would be implemented efficiently is that a generic implementation wouldn't capture the raw request message.

  • Even if it did, you would have to "poke around" with the internals of a class that your code shouldn't be using directly. This is a bad idea for obvious reasons.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜