Mina - HTTP Proxy – what is AbstractHttpLogicHandler for?
I开发者_高级运维 am currently working on building a simple HTTP proxy using Apache Mina, in particular org.apache.mina.proxy, and I have a few questions about how to use some of the components.
How do I extract the future address from an incoming HTTP request? I can see how to create a ProxyConnection given a URL, but I can't see how to extract this from an incoming request. I have a feeling this leads to my next question:
What is AbstractHttpLogicHandler for? I see it has a subclass, HttpSmartProxyHandler, but I am not sure if and how to use it.
Is there an example somewhere that I could look at? I've been looking at http://mina.apache.org/report/trunk/xref/org/apache/mina/example/proxy/ but it doesn't seem to answer my questions above.
I think that classes in org.apache.mina.proxy are classes to add proxy in you HTTP request and not classes you can directly used to build your proxy.
About your second point: AbstractHttpLogicHandler
is an abstract class that decorates AbstractProxyLogicHandler
"
AbstractHttpLogicHandler
provides HTTP request encoding/response
decoding functionality"
HttpSmartProxyHandler
is a concrete class that extends AbstractProxyLogicHandler
.
This class fulfills its contract by handling a HTTP response from the proxy server (by implementing handleResponse(final HttpProxyResponse response)
)
精彩评论