cancel
Showing results for 
Search instead for 
Did you mean: 

Get session Id

Former Member
0 Kudos

Hi everyone,

How can I get the session Id in a Web dynpro App?

Regards,

Eduardo Campos.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Eduardo,

just include the servlet.jar in your library (if it is not included).

then use the following code

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

Regards

Former Member
0 Kudos

Hi,

Please refer the following threads.

Read Session Id.

Find session id from Webdynpro

Session object in webdynpro

Thanks

Abhilasha

pravesh_verma
Active Contributor
0 Kudos

Hi Eduardo ,

Please try this code:


HttpServletRequest request = (HttpServletRequest) WDProtocolAdapter.getProtocolAdapter().getRequestObject().getProtocolRequest();
HttpSession session = request.getSession();
String sessionId = session.getId();

Also make sure that you include the servlet.jar in your libraries to get the object of HttpServletRequest.

I am sure this will help you. Please revert back in case you want any further information.

Thanks and Regards,

Pravesh

Former Member
0 Kudos

Hi Pravesh,

Does this code works in CE 7.1?

Regards,

Eduardo Campos

Former Member
0 Kudos

Hi,

In CE you can use this code:

HttpServletRequest request = (HttpServletRequest)WDProtocolAdapter.getProtocolAdapter()
                                                                  .getRequestObject()
                                                                  .getProtocolRequest();
	  
String sessionID = request.getSession().getId();

Regards,

Satyajit

Former Member
0 Kudos

Hi Satyajit,

Do I need to include some library in dependecies?

Regards,

Eduardo Campos.

Former Member
0 Kudos

Hi Satyajit,

I don't see the method getProtocolRequest in WDProtocolAdapter.getProtocolAdapter()

.getRequestObject()

Regards,

Eduardo Campos.

Former Member
0 Kudos

Hi,

Which version are you in? I have CE 7.1 Ehp1 and I can use this method. You don't need to add any extra dependencies, it should be automatically sorted.

Regards,

Satyajit

Former Member
0 Kudos

Hi Satyajit,

I have CE 7.1 without EHP1 and i don't see this method.

Regards.