use of com.sun.identity.liberty.ws.interaction.jaxb.ParameterType in project OpenAM by OpenRock.
the class WSPRedirectHandlerServlet method sendInteractionResponsePage.
private void sendInteractionResponsePage(String messageID, HttpServletRequest httpRequest, HttpServletResponse httpResponse, String returnToURL) throws IOException {
if (debug.messageEnabled()) {
debug.message("WSPRedirectHandlerServlet.sendInteractionResponsePage():" + "entering");
}
try {
//read and save query parameters;
InteractionResponseElement interactionResponseElement = JAXBObjectFactory.getObjectFactory().createInteractionResponseElement();
List list = interactionResponseElement.getParameter();
Enumeration parameterNames = httpRequest.getParameterNames();
while (parameterNames.hasMoreElements()) {
String parameterName = (String) parameterNames.nextElement();
/*
ParameterType parameterType
= JAXBObjectFactory.getObjectFactory()
.createParameterType();
*/
String parameterValue = httpRequest.getParameter(parameterName);
if (debug.messageEnabled()) {
debug.message("WSPRedirectHandlerServlet" + ".sendInteractionResponsePage():" + "parameterName=" + parameterName + ", parameterValue=" + parameterValue);
}
int index = parameterName.indexOf(PARAMETER_PREFIX);
if (index != -1) {
ParameterType parameterType = JAXBObjectFactory.getObjectFactory().createParameterType();
parameterName = parameterName.substring(index + PARAMETER_PREFIX.length());
parameterType.setName(parameterName);
parameterType.setValue(parameterValue);
list.add(parameterType);
}
}
if (LogUtil.isLogEnabled()) {
String[] objs = new String[1];
objs[0] = messageID;
LogUtil.access(Level.INFO, LogUtil.IS_COLLECTED_RESPONSE_FROM_USER_AGENT, objs);
}
//store InteractionResponse in interaction manager;
InteractionManager.getInstance().setInteractionResponseElement(messageID, interactionResponseElement);
if (returnToURL.indexOf("?") != -1) {
returnToURL = returnToURL + "&" + InteractionManager.RESEND_MESSAGE + "=" + InteractionManager.getInstance().getRequestMessageID(messageID);
} else {
returnToURL = returnToURL + "?" + InteractionManager.RESEND_MESSAGE + "=" + messageID;
}
if (debug.messageEnabled()) {
debug.message("WSPRedirectHandlerServlet." + " sendInteractionResponsePage():" + "redirecting user agent to returnToURL=" + returnToURL);
}
httpResponse.sendRedirect(returnToURL);
if (LogUtil.isLogEnabled()) {
String[] objs = new String[1];
objs[0] = messageID;
LogUtil.access(Level.INFO, LogUtil.IS_REDIRECTED_USER_AGENT_BACK, objs);
}
} catch (JAXBException je) {
debug.error("WSPRedirectHandlerServlet.sendInteractionResponsePage():" + "catching JAXBException =", je);
showErrorPage(httpRequest, httpResponse, "Error createing JAXBObject:" + je.getMessage());
} catch (Exception e) {
debug.error("WSPRedirectHandlerServlet.sendInteractionResponsePage():" + "catching Exception =", e);
}
}
use of com.sun.identity.liberty.ws.interaction.jaxb.ParameterType in project OpenAM by OpenRock.
the class InteractionUtils method getParameters.
/**
* Returns user friendly <code>Map</code> representation of parameters
* in interaction response element
*
* @param interactionResponseElement obtained from
* <code>InteractionManager</code>
* @return a Map of parameters. Keys of the map are parameter
* name String objects. Values in the map are parameter value
* String objects
*/
public static Map getParameters(InteractionResponseElement interactionResponseElement) {
List parameters = interactionResponseElement.getParameter();
Map pm = new HashMap();
Iterator iter = parameters.iterator();
while (iter.hasNext()) {
ParameterType pt = (ParameterType) iter.next();
pm.put(pt.getName(), pt.getValue());
}
return pm;
}
Aggregations