Re: [Simpleweb-Support] Checking SSL for a connection
Brought to you by:
niallg
From: Niall G. <gal...@ya...> - 2006-03-21 16:10:45
|
Hi Luke, Just create a PipelineFactory and check the socket type. For example, public class MyPipelineFactory implements PipelineFactory { public Pipeline getInstance(Socket sock) { Pipeline pipe = new Pipeline(sock); if(sock instanceof SSLSocket) { pipe.put("SSLSession", ((SSLSocket)sock).getSession()); } return pipe; } } And then from the ProtocolHandler.handle you will be able to do the following. SSLSession session = Request.getAttribute("SSLSession"); if(session == null) { // not an ssl connection. } Of course, you can implement a more suitable scheme. The point here is that the Pipeline attributes are available throught the Request object. Via both Request.getAttribute and Request.getAttributes. Have a look at BufferedPipelineFactory for an example, and also simple.http.connect.ConnectionFactory to see how a pipeline factory can be added into the conncection procedure. Niall --- Luke Miller <lu...@so...> wrote: > Is there a way to determine if a connection is using > SSL or not > (either by scheme, port, or a direct convenience > method) in the > handle method of the ProtocolHandler? > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a > groundbreaking scripting language > that extends applications into web and mobile media. > Attend the live webcast > and join the prime developer group breaking into > this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > Niall Gallagher __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |