logo       
Bookmark and Share

Re: How find Ip Address of clients who r currentlt logged in: msg#00142

java.jetty.support

Subject: Re: How find Ip Address of clients who r currentlt logged in


The session manager is configurable and you can call setSessionManager
on the ServletHandler (which you can get from the HttpContext or
WebApplicationContext).

I'll add the following method to AbstractSessionManager:

public Map getSessionMap()
{
return Collections.unmodifiableMap(_sessions);
}

This will allow you to query a SessionManager for it's active session.

I'll also make some private attributes public so that you can do
fancier things with the session manager if you want.

regards



SUDHAKER RAJ wrote:> Guess your question was mis-understood and what you were
looking for is
> all active HttpSession objects inside the Context.
>
>
> Jetty has an interface
> org.mortbay.jetty.servlet.SessionManager
>
> which is implemented by
> org.mortbay.jetty.servlet.AbstractSessionManager
>
> which is again inherited by
> org.mortbay.jetty.servlet.HashSessionManager.
>
>
> Jetty-4.2.3 AbstractSessionManager (line 62)
> ### private transient Map _sessions;
>
> this guy is holding all sessions for given Context.
>
> And it is defined private :-(
>
>
> Two options: make it protected or add a method in it like this
>
> /* ------------------------------------------------------------ */
> public HttpSession[] getAllHttpSession()
> {
> // to do. Map to HttpSession[]
> }
>
> the only place I found HashSessionManager referenced is
> org.mortbay.jetty.servlet.ServletHandler - which is again not
> accessible. Which is another problem...
>
> But ServletHandler class see Context too which is visible to world - so
> HashSessionManager can be pushed somewhere in Context easily and made
> available to any JSP/Servlet.
>
> recompile Jetty and can use this new hook, if really needed ;-)
>
> Jetty's archtitect can surely suggest something better :-D
>
> There should be some way to have any SessionManager through
> configuration file like iPlabet Web Server have. But I see a hard
> coding at ServletHandler (line 176) as _sessionManager = new
> HashSessionManager(); and look like it can't be configured for Jetty in
> it's current shape.
>
>
>
> @@@ Other simple approach: Don't break Jetty. Just add an application
> level object (may be HashMap) and maintain your own parallel session
> through your Login/Logout code. Needless to say, you need a cleaning
> thread to time-out people who are inactive for long or haven't logged
> out properly. BUT THIS WILL ONLY GIVE YOU AUTHENTICATED USER's LIST,
> NOT ALL SESSIONS IN CONTEXT.
>
>
> MIND, IP WILL NOT BE AVAILABLE VIA SESSION IN BOTH CASES. CLIENT'S IP
> IS AVAILABLE TO REQUEST OBJECT ONLY, WHICH DIES AFTER REQUEST IS
> SERVED. SO YOU HAVE TO PUSH IT SOMEWHERE PROGRAMATICALLY (MOST LIKELY,
> SESSION).
>
> --- Chris Haynes <chris@xxxxxxxxxxxxxxxxx> wrote:
>
>>The only way I know without writing a special client-server
>>combination is just to keep refreshing the page.
>><meta content='5' http-equiv='refresh'>
>>in the page <head> section will refresh every 5 secs.
>>BUT think about the server load!
>>Chris
>>----- Original Message -----
>>From: <ratan_njit@xxxxxxxxx>
>>To: <jetty-support@xxxxxxxxxxxxxxx>
>>Sent: Thursday, December 12, 2002 12:49 AM
>>Subject: [jetty-support] How find Ip Address of clients who r
>>currentlt logged in
>>
>>
>>>hi,
>>>I have one more question.I am implementing a user interface which
>>>displays the clients who are currently accessing ur server.
>>>this display must change dynamically.
>>>can anyone please help me how can i go about displaying the current
>>>clients.
>>>Thank You.
>>>Ratan
>>>
>>>
>>>--- In jetty-support@xxxxxxxxxxxxxxx, Greg Wilkins <gregw@xxxx>
>>>wrote:
>>>
>>>>Such a handler is provided with Jetty:
>>>>
>>>> src/org/mortbay/http/handler/IPAccessHandler.java
>>>>
>>>>Althought Eoins comments about this not being a real firewall
>>
>>hold
>>
>>>true.
>>>
>>>>cheers
>>>>
>>>>
>>>>Eoin Woods wrote:> You normally wouldn't use an HTTP server to
>>>
>>>implement a firewall. A
>>>
>>>>>firewall is normally a piece of hardware which you configure to
>>>
>>>permit
>>>
>>>>>or deny access to certain types of traffic or alternatively you
>>>
>>>can get
>>>
>>>>>software firewalls which perform the same job in the OS's
>>>
>>>network
>>>
>>>>>layer. The advantage of this approach is that you stop the
>>>
>>>traffic
>>>
>>>>>getting into your network at all.
>>>>>
>>>>>Having said that, you could create a Jetty handler or servlet
>>>
>>>filter
>>>
>>>>>which checked the client address and rejected it if it didn't
>>>
>>>like it.
>>>
>>>>>However, in this case you're relying much more on the security
>>>
>>>of your
>>>
>>>>>operating system and Jetty than in the firewall case.
>>>>>
>>>>>Eoin.
>>>>>
>>>>> -----Original Message-----
>>>>> *From:* ratan <ratan_njit@xxxx> [mailto:ratan_njit@xxxx]
>>>>> *Sent:* 09 December 2002 09:40
>>>>> *To:* jetty-support@xxxxxxxxxxxxxxx
>>>>> *Subject:* [jetty-support] How to ban an IP Address to
>>>
>>>access my Server
>>>
>>>>> Hello,
>>>>> I am implementing a firewall for HTTP server.once i start
>>
>>my
>>
>>>Jetty
>>>
>>>>> HTTP server then anyone can access my server with ipaddress
>>>
>>>followed
>>>
>>>>> by :8080.I think iam right so far.
>>>>>
>>>>> now I want to block a machine to access my HTTP
>>
>>server,which
>>
>>>is
>>>
>>>>> blocking a specific IP address to access the server.
>>>>> how can I do that.please help me with that.
>>>>>
>>>>> Please reply asap.
>>>>> Thank You.
>>>>> Regards.
>>>>> Ratan
>>>>>
>>>>>
>>>>>
>>>>> For the latest information about Jetty, please see
>>>>> http://jetty.mortbay.org
>>>>>
>>>>>
>>>>>
>>>>> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>>>
>>>Service
>>>
>>>>> <http://docs.yahoo.com/info/terms/>.
>>>>>
>>>>>
>>>>>*Yahoo! Groups Sponsor*
>>>>>ADVERTISEMENT
>>>>>
>>>
>><http://rd.yahoo.com/M=234081.2711418.4084139.1925585/D=egroupweb/S=1
>>
>>705375618:HM/A=1328027/R=0/*http://ad.doubleclick.net/clk;4870030;758
>>
>>>6687;u?http://www.ameriquestmortgage.com/welcome.html?ad=Yahoo01>
>>>
>>>>>
>>>>>For the latest information about Jetty, please see
>>>
>>>http://jetty.mortbay.org
>>>
>>>>>
>>>>>
>>>>>Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>>>
>>>Service
>>>
>>>>><http://docs.yahoo.com/info/terms/>.
>>>>
>>>>
>>>>
>>>>--
>>>>Greg Wilkins<gregw@xxxx> Phone/fax: +44 7092063462
>>>>Mort Bay Consulting Australia and UK.
>>>
>>>http://www.mortbay.com
>>>
>>>
>>>------------------------ Yahoo! Groups
>>
>>Sponsor ---------------------~-->
>>
>>>Get 128 Bit SSL Encryption!
>>>http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/CefplB/TM
>>>
>>
>>--------------------------------------------------------------------
>>-~->
>>
>>>For the latest information about Jetty, please see
>>
>>http://jetty.mortbay.org
>>
>>>
>>>
>>>Your use of Yahoo! Groups is subject to
>>
>>http://docs.yahoo.com/info/terms/
>>
>>>
>>>
>>>
>>
>>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
>
> For the latest information about Jetty, please see http://jetty.mortbay.org
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>



--
Greg Wilkins<gregw@xxxxxxxxxxx> Phone/fax: +44 7092063462
Mort Bay Consulting Australia and UK. http://www.mortbay.com


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/CefplB/TM
---------------------------------------------------------------------~->

For the latest information about Jetty, please see http://jetty.mortbay.org



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise