Support Article
NullPointerException for pxHTTPServletRequest
SA-36071
Summary
Getting exception when writing a function to get the HTTP header through a Java step like this :
javax.servlet.http.HttpServletRequest req=(javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject("pxHTTPServletRequest");
When I use same thing as a Property-Set step like this:
@java("((javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject(\"pxHTTPServletRequest\")).getHeader (\"standardid\")")
- it works fine.
Error Messages
Exception java.lang.NullPointerException
Steps to Reproduce
Set a java step in authentication activity :
javax.servlet.http.HttpServletRequest req=(javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject("pxHTTPServletRequest");
Root Cause
The pxHTTPServletRequest object is available during an authentication activity - during a Property-Set or a Java step. It is not available after that.
Resolution
Explanation : The scope of pxHTTPServletRequest is limited to authentication process.
Published April 7, 2017 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.