Re: [Simpleweb-Support] Missing getInetAddress on Request in Simple v4.0
Brought to you by:
niallg
From: Niall G. <gal...@ya...> - 2008-08-18 12:15:16
|
Hi, Ya its still possible to get the client address. Here is what to do. public class MyProcessor implements Processor { private Processor processor; public MyProcessor(Processor processor) { this.processor = processor; } public void process(Pipeline pipeline) throws Exception { Map map = pipeline.getAttributes(); Socket socket = pipeline.getSocket().socket(); // get socket InetAddress address = socket.getInetAddress(); // get client address map.put("myKeyForAddres", address); processor.process(pipeline); // forward to main processor } public void stop() throws Exception { processor.stop(); } } Then with your request you can get. InetAddress address = request.getAttributes().get("myKeyForAddress"); This kind of attribute passing can also be used for handing over SSL certificates, and other connection based properties. I will add the getInetAddress as getClientAddress in a future release. Regards, Niall --- On Mon, 8/18/08, zwj...@sn... <zwj...@sn...> wrote: > From: zwj...@sn... <zwj...@sn...> > Subject: [Simpleweb-Support] Missing getInetAddress on Request in Simple v4.0 > To: sim...@li... > Date: Monday, August 18, 2008, 4:55 AM > Hi, > > Great work on the new version of Simple! I am missing the > old method getInetAddress() on Request - how come this has > been removed in the new version? Is it possible to somehow > get the address of the client requesting a resource? > > Thanks. > > > Regards, > A user of Simple > > -------------------------------------- > Protect yourself from spam, > use http://sneakemail.com > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move > Developer's challenge > Build the coolest Linux based applications with Moblin SDK > & win great prizes > Grand prize is a trip for two to an Open Source event > anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support |