Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Get IP Address from Client Session
Get IP Address from Client Session [message #1831659] Wed, 26 August 2020 08:22 Go to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 128
Registered: June 2014
Location: Paris
Senior Member
Hello,
is there a way to get IP address from client that created the session in eclipse scout SDK ?
Kind Regards

[Updated on: Wed, 26 August 2020 08:23]

Report message to a moderator

Re: Get IP Address from Client Session [message #1831672 is a reply to message #1831659] Wed, 26 August 2020 10:39 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Not by default. But you could provide your own Java implementation of a "org.eclipse.scout.rt.ui.html.UiSession" by using Scout's BEANS / @Replace mechanism. Override #getOrCreateClientSession and add the IP information from the HttpServletRequest to the jsonStartupReq.getSessionStartupParams() Map. Later you can access the startup params via AbstractDesktop#getStartupRequestParam(String).

Cheers
André


Eclipse Scout Homepage | Documentation | GitHub
Re: Get IP Address from Client Session [message #1832013 is a reply to message #1831672] Fri, 04 September 2020 20:11 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 128
Registered: June 2014
Location: Paris
Senior Member
Hello André,
I have tried that but I am stuck in the fact that the map returned is unmodifiable, so it is not possible to add a new param to that existing map.
Kind Regards
Re: Get IP Address from Client Session [message #1832036 is a reply to message #1832013] Mon, 07 September 2020 07:21 Go to previous message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Just create a new map instance then. You could override UiSession#createAndStartClientSession to do that (untested):

  protected IClientSession createAndStartClientSession(Locale locale, UserAgent userAgent, Map<String, String> sessionStartupParams) {
    Map<String, String> modfiableMap = new HashMap<>(sessionStartupParams);
    modifiableMap.put("ipAddress", "[value]");
    return BEANS.get(ClientSessionProvider.class).provide(ClientRunContexts.copyCurrent()
        .withLocale(locale)
        .withUserAgent(userAgent)
        .withProperties(modifiableMap)); // Make startup parameters available at {@link PropertyMap#CURRENT} during client session is starting.
  }

Cheers
André


Eclipse Scout Homepage | Documentation | GitHub

[Updated on: Mon, 07 September 2020 11:26]

Report message to a moderator

Previous Topic:Where locate static file?
Next Topic:Table Sort 2 Columns
Goto Forum:
  


Current Time: Tue Apr 16 04:56:21 GMT 2024

Powered by FUDForum. Page generated in 0.65365 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top