use of com.sun.identity.liberty.ws.interaction.jaxb.RedirectRequestElement in project OpenAM by OpenRock.
the class InteractionManager method newRedirectFault.
private SOAPFaultException newRedirectFault(String messageID) {
RedirectRequestElement re = null;
try {
re = objectFactory.createRedirectRequestElement();
} catch (JAXBException je) {
debug.error("InteractionManager.newRedirectFault():" + " can not create RedirectRequestElement", je);
}
CorrelationHeader ch = new CorrelationHeader();
String responseID = ch.getMessageID();
ch.setRefToMessageID(messageID);
String redirectUrl = null;
String lbRedirectUrl = interactionConfig.getLbWSPRedirectHandler();
String wspRedirectUrl = interactionConfig.getWSPRedirectHandler();
if (debug.messageEnabled()) {
debug.message("InteractionManager.newRedirectURLFault():" + "wspRedirectURL:" + wspRedirectUrl + ", lbRedirectUrl:" + lbRedirectUrl);
}
if (lbRedirectUrl == null) {
redirectUrl = wspRedirectUrl + "?" + TRANS_ID + "=" + responseID;
if (debug.messageEnabled()) {
debug.message("InteractionManager.newRedirectURLFault():" + "lbRedirectURL is null, rediectUrl:" + redirectUrl);
}
} else {
//lbRedirectUrl defined
redirectUrl = lbRedirectUrl + "?" + TRANS_ID + "=" + responseID + "&" + InteractionConfig.HANDLER_HOST_ID + "=" + InteractionConfig.getInstance().getLocalServerId();
if (debug.messageEnabled()) {
debug.message("InteractionManager.newRedirectURLFault():" + "lbRedirectURL is not null, rediectUrl:" + redirectUrl);
}
}
re.setRedirectURL(redirectUrl);
List details = new ArrayList();
try {
details.add(Utils.convertJAXBToElement(re));
} catch (JAXBException je) {
debug.error("InteractionManager.newRedirectFault():" + " can not create newRedirectFault:" + " can not convert JAXBObject to Element", je);
}
SOAPFault sf = new SOAPFault(QNAME_SERVER, SERVER_ERROR, FAULT_ACTOR, new SOAPFaultDetail(details));
Message sfmsg = new Message(sf);
sfmsg.setCorrelationHeader(ch);
SOAPFaultException sfe = new SOAPFaultException(sfmsg);
return sfe;
}
use of com.sun.identity.liberty.ws.interaction.jaxb.RedirectRequestElement in project OpenAM by OpenRock.
the class InteractionManager method getRedirectURL.
String getRedirectURL(SOAPFaultException sfe) throws SOAPFaultException {
String redirectURL = null;
List details = null;
SOAPFaultDetail sfd = sfe.getSOAPFaultMessage().getSOAPFault().getDetail();
if (sfd != null) {
details = sfd.getOtherChildren();
}
try {
details = Utils.convertElementToJAXB(details);
} catch (JAXBException je) {
debug.error("InteractionManager.getRedirectURL():" + " can not get Redirect URL", je);
}
if ((details != null) && (details.size() > 0) && (details.get(0) instanceof RedirectRequestElement)) {
RedirectRequestElement rre = (RedirectRequestElement) details.get(0);
if (rre != null) {
redirectURL = rre.getRedirectURL();
}
}
if (redirectURL == null) {
throw sfe;
}
return redirectURL;
}
Aggregations