/** * Custom serialization logic which transform XMLObject into String. * * @param out output stream * @throws java.io.IOException error performing XMLObject serialization */ private void writeObject(ObjectOutputStream out) throws IOException { try { if (serializedObject == null) { serializedObject = XMLHelper.nodeToString(SAMLUtil.marshallMessage(getObject())); } out.writeObject(serializedObject); } catch (MessageEncodingException e) { log.error("Error serializing SAML object", e); throw new IOException("Error serializing SAML object: " + e.getMessage()); } }
/** * Custom serialization logic which transform List of XMLObject into List of Strings. * * @param out output stream * @throws java.io.IOException error performing XMLObject serialization */ private void writeObject(ObjectOutputStream out) throws IOException { try { if (serializedObject == null) { ArrayList<String> serializedItems = new ArrayList<String>(); for (T item : getObject()) { serializedItems.add(XMLHelper.nodeToString(SAMLUtil.marshallMessage(item))); } serializedObject = serializedItems; } out.writeObject(serializedObject); } catch (MessageEncodingException e) { log.error("Error serializing SAML object", e); throw new IOException("Error serializing SAML object: " + e.getMessage()); } }
/** * Log the encoded message to the protocol message logger. * * @param messageContext the message context to process */ protected void logEncodedMessage(MessageContext messageContext) { if(protocolMessageLog.isDebugEnabled() && messageContext.getOutboundMessage() != null){ if (messageContext.getOutboundMessage().getDOM() == null) { try { marshallMessage(messageContext.getOutboundMessage()); } catch (MessageEncodingException e) { log.error("Unable to marshall message for logging purposes: " + e.getMessage()); return; } } protocolMessageLog.debug("\n" + XMLHelper.prettyPrintXML(messageContext.getOutboundMessage().getDOM())); } }
} catch (MessageEncodingException e) { throw new ServletException( "SAML encoding error: " + e.getMessage(), e);