Skip to main content

Support Article

NullPointerException while reading header for Rest Service



It is observed that  getObject(“pxHTTPServletRequest”) returns null when the authentication activity is run through the REST service.
So user is unable to determine in the authentication activity, who is trying to login.

Error Messages

Not Applicable.

Steps to Reproduce

1. Create a Service Package with Custom Authentication Service
2. Configure with custom authentication activity with no additional challenge options. The Authentication activity just checks the http header for the user name.
3. Attempt to read the HTTP requestor header which contains the user name.

javax.servlet.http.HttpServletRequest request = (javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject("pxHTTPServletRequest");
String ivuser = request.getHeader("user");
tools.putParamValue("user", user);

Root Cause

Servlet request object is not available in custom authentication activity.


This issue is resolved by Hfix-22594.
Suggest Edit

Published July 6, 2015 - Updated October 8, 2020

Did you find this content helpful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us