Question

3
Replies
354
Views
Close popover
Gaurav Srivastava (GauravS9130)
Apple Inc

Apple Inc
US
GauravS9130 Member since 2018 8 posts
Apple Inc
Posted: March 12, 2019
Last activity: March 22, 2019
Closed

How to getSession from HttpServletRequest

Hi Team,

We have written a filter where we are saving some details in HTTPSession like below.

// Create a new session
HttpSession session = httpServletRequest.getSession(true);
// Create the session bean
SessionBean sessionBean = SessionBean.builder().id(1263333)
.type("XYZ").build();
//Set the session bean with required details into session
session.setAttribute(SESSION_BEAN_NAME, sessionBean);
We are trying to read it in our authentication activity inside java step like below.

javax.servlet.http.HttpServletRequest request =
(javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject("pxHTTPServletRequest");

javax.servlet.http.HttpSession sessionDetails = request.getSession(); // Always returning NULL ??

But getSession is always returning null inside activity. We are able to read other HttpServletRequest methods like getCookies.

Please provide input in case you also have encountered similar situation.

Thanks

Gaurav

Pega Platform Low-Code App Development Data Integration Java and Activities
Moderation Team has archived post,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.