How to set Status into Response?
o haya
ohaya at yahoo.com
Sat Feb 16 05:04:20 EST 2019
Hi,
Ok, I figured this out.
I made a method:
private static Status buildStatus(String status, String statMsg) {
Status stat = new StatusBuilder().buildObject();
// Set the status code.
StatusCode statCode = new StatusCodeBuilder().buildObject();
statCode.setValue(status);
stat.setStatusCode(statCode);
// Set the status Message.
if (statMsg != null) {
StatusMessage statMesssage = new StatusMessageBuilder().buildObject();
statMesssage.setMessage(statMsg);
stat.setStatusMessage(statMesssage);
}
return stat;
}
Then, I use that as follows:
Status myStatus = buildStatus("urn:oasis:names:tc:SAML:2.0:status:Success", null);
resp.setStatus(myStatus);
Thanks,Jim
On Saturday, February 16, 2019, 3:47:53 AM EST, o haya <ohaya at yahoo.com> wrote:
Hi,
I am trying to add a <Status> to the Response that I am building:
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
but I am having problems.
I have this method that I call:
Status myStatus = buildStatus("urn:oasis:names:tc:SAML:2.0:status:Success", "ABCDEF");
if (myStatus == null) {
System.out.println("myStatus is null");
} else {
System.out.println("myStatus is NOT null");
}
and that is saying "NOT null". However, when I try to set the Status into the Response:
resp.getStatus().setStatusCode(myStatus.getStatusCode());
I am getting a NullPointerException.
Why is that, and how SHOULD I be doing that?
Thanks,
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/dev/attachments/20190216/68e8da10/attachment-0001.html>
More information about the dev
mailing list