コード例 #1
0
  /**
   * Base64 the given SAML message.
   *
   * @param message the SAML message
   * @return Base64 encoded message
   * @throws MarshallingException if there is a problem marshalling the XMLObject
   * @throws UnsupportedEncodingException If the named charset is not supported
   */
  @Nonnull
  public String encodeMessage(@Nonnull final SAMLObject message)
      throws MarshallingException, UnsupportedEncodingException {
    final Element domMessage = XMLObjectSupport.marshall(message);
    final String messageXML = SerializeSupport.nodeToString(domMessage);

    return Base64Support.encode(messageXML.getBytes("UTF-8"), Base64Support.UNCHUNKED);
  }
コード例 #2
0
  /**
   * Helper method that marshalls the given message.
   *
   * @param message message the marshall and serialize
   * @return marshalled message
   * @throws MessageEncodingException thrown if the give message can not be marshalled into its DOM
   *     representation
   */
  protected Element marshallMessage(XMLObject message) throws MessageEncodingException {
    log.debug("Marshalling message");

    try {
      return XMLObjectSupport.marshall(message);
    } catch (MarshallingException e) {
      throw new MessageEncodingException("Error marshalling message", e);
    }
  }
コード例 #3
0
 /** {@inheritDoc} */
 protected void marshallAttributes(XMLObject xmlObject, Element domElement)
     throws MarshallingException {
   AttributedQName attributedQName = (AttributedQName) xmlObject;
   XMLObjectSupport.marshallAttributeMap(attributedQName.getUnknownAttributes(), domElement);
 }
 /** {@inheritDoc} */
 protected void marshallAttributes(XMLObject xmlObject, Element domElement)
     throws MarshallingException {
   AttributedUnsignedLong aul = (AttributedUnsignedLong) xmlObject;
   XMLObjectSupport.marshallAttributeMap(aul.getUnknownAttributes(), domElement);
 }