Is it possible to get the raw request of HttpExchange?
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.
精彩评论