cancel
Showing results for 
Search instead for 
Did you mean: 

How to get HttpSession in Weddynpro NW 7.0?

Former Member
0 Kudos

Do you know how to do the same code below in NW 7.0?

NW 04 way:

HttpServletRequest request =((IWebContextAdapter)WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
HttpSession session = request.getSession();

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can also achieve the session Sotrage, this way from web dynpro.

//Setting value in session

IMaintainScope maintainer = Utils.getScopeMaintainer(WDScopeType.CLIENTSESSION_SCOPE);

maintainer.getScope().put("Session_Key", value);

//Getting value from session

IMaintainScope maintainer = Utils.getScopeMaintainer(WDScopeType.CLIENTSESSION_SCOPE);

if(maintainer.getScope().get("Session_Key") != null){

value = maintainer.getScope().get("Session_Key).toString();

}

I Hope it helps

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi shabir rahim ,

do you know if this way of storing a value in a session is supported in NW 7.0?

or if they plan to deprecate it later on? i dont want to build a solution based off it and have them take the API away later....this has happened too many times....

Edited by: K Ferguson on Sep 11, 2008 10:48 PM

Former Member
0 Kudos

We have worked in EP 7.0 only and we have used this.

This is a easier way to store and retrieve , supported by webdynpro

Former Member
0 Kudos

i need to get the unique session id for a custom usage tracking application...is there any way to get a unique id that identifies the users browser session?

vmadhuvarshi_
Contributor
0 Kudos

I'm not aware of how user browser session can be tracked in WD Java.

However, if your application is running inside Portal or requires authentication, you can track the users with help of application parameters. I hope I did not wander too far off from your concern.

Vishwas.

Former Member
0 Kudos

I am utimately only trying to get the unique browser sessionId...

String sessionId = session.getId();


HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
HttpSession session = request.getSession();
String sessionId = session.getId();

Edited by: K Ferguson on Sep 9, 2008 5:32 PM

vmadhuvarshi_
Contributor
0 Kudos

Hello,

I'm afraid that you can't access HttpServletSession object in WebDynpro via public API. See [this thread|https://www.sdn.sap.com/irj/sdn/thread?messageID=1329730#1329730].

What is that you need to access Session for? You can get the request object with code given below though.


IWDProtocolAdapter prt = WDProtocolAdapter.getProtocolAdapter();
IWDRequest req = prt.getRequestObject();

Vishwas.