本文整理汇总了Java中org.opensaml.xml.io.MarshallingException类的典型用法代码示例。如果您正苦于以下问题:Java MarshallingException类的具体用法?Java MarshallingException怎么用?Java MarshallingException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MarshallingException类属于org.opensaml.xml.io包,在下文中一共展示了MarshallingException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
PolicyReference pr = (PolicyReference) xmlObject;
if (pr.getURI() != null) {
domElement.setAttributeNS(null, PolicyReference.URI_ATTRIB_NAME, pr.getURI());
}
if (pr.getDigest() != null) {
domElement.setAttributeNS(null, PolicyReference.DIGEST_ATTRIB_NAME, pr.getDigest());
}
if (pr.getDigestAlgorithm() != null) {
domElement.setAttributeNS(null, PolicyReference.DIGEST_ALGORITHM_ATTRIB_NAME, pr.getDigestAlgorithm());
}
XMLHelper.marshallAttributeMap(pr.getUnknownAttributes(), domElement);
}
示例2: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
Logo logo = (Logo) samlObject;
if (logo.getXMLLang() != null) {
Attr attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), SAMLConstants.XML_NS,
LangBearing.XML_LANG_ATTR_LOCAL_NAME, SAMLConstants.XML_PREFIX);
attribute.setValue(logo.getXMLLang());
domElement.setAttributeNodeNS(attribute);
}
if (logo.getHeight() != null) {
domElement.setAttributeNS(null, Logo.HEIGHT_ATTR_NAME, logo.getHeight().toString());
}
if (logo.getWidth() != null) {
domElement.setAttributeNS(null, Logo.WIDTH_ATTR_NAME, logo.getWidth().toString());
}
}
示例3: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
XACMLAuthzDecisionQueryType query = (XACMLAuthzDecisionQueryType) samlObject;
if (query.getInputContextOnlyXSBooleanValue() != null) {
domElement.setAttributeNS(null, XACMLAuthzDecisionQueryType.INPUTCONTEXTONLY_ATTRIB_NAME, query
.getInputContextOnlyXSBooleanValue().toString());
}
if (query.getReturnContextXSBooleanValue() != null) {
domElement.setAttributeNS(null, XACMLAuthzDecisionQueryType.RETURNCONTEXT_ATTRIB_NAME, query
.getReturnContextXSBooleanValue().toString());
}
if (query.getCombinePoliciesXSBooleanValue() != null) {
domElement.setAttributeNS(null, XACMLAuthzDecisionQueryType.COMBINEPOLICIES_ATTRIB_NAME, query
.getCombinePoliciesXSBooleanValue().toString());
}
super.marshallAttributes(samlObject, domElement);
}
示例4: marshall
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/**
* Marshall an XMLObject. If the XMLObject already has a cached DOM via {@link XMLObject#getDOM()},
* that Element will be returned. Otherwise the object will be fully marshalled and that Element returned.
*
* @param xmlObject the XMLObject to marshall
* @return the marshalled Element
* @throws MarshallingException if there is a problem marshalling the XMLObject
*/
public static Element marshall(XMLObject xmlObject) throws MarshallingException {
Logger log = getLogger();
log.debug("Marshalling XMLObject");
if (xmlObject.getDOM() != null) {
log.debug("XMLObject already had cached DOM, returning that element");
return xmlObject.getDOM();
}
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(xmlObject);
if (marshaller == null) {
log.error("Unable to marshall XMLOBject, no marshaller registered for object: "
+ xmlObject.getElementQName());
}
Element messageElem = marshaller.marshall(xmlObject);
if (log.isTraceEnabled()) {
log.trace("Marshalled XMLObject into DOM:");
log.trace(XMLHelper.nodeToString(messageElem));
}
return messageElem;
}
示例5: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
NameIDPolicy policy = (NameIDPolicy) samlObject;
if (policy.getFormat() != null) {
domElement.setAttributeNS(null, NameIDPolicy.FORMAT_ATTRIB_NAME, policy.getFormat());
}
if (policy.getSPNameQualifier() != null) {
domElement.setAttributeNS(null, NameIDPolicy.SP_NAME_QUALIFIER_ATTRIB_NAME, policy.getSPNameQualifier());
}
if (policy.getAllowCreateXSBoolean() != null) {
domElement.setAttributeNS(null, NameIDPolicy.ALLOW_CREATE_ATTRIB_NAME, policy.getAllowCreateXSBoolean()
.toString());
}
}
示例6: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
public void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
AuthorityBinding authorityBinding = (AuthorityBinding) samlElement;
if (authorityBinding.getAuthorityKind() != null) {
QName authKind = authorityBinding.getAuthorityKind();
domElement.setAttributeNS(null, AuthorityBinding.AUTHORITYKIND_ATTRIB_NAME, XMLHelper
.qnameToContentString(authKind));
}
if (authorityBinding.getBinding() != null) {
domElement.setAttributeNS(null, AuthorityBinding.BINDING_ATTRIB_NAME, authorityBinding.getBinding());
}
if (authorityBinding.getLocation() != null) {
domElement.setAttributeNS(null, AuthorityBinding.LOCATION_ATTRIB_NAME, authorityBinding.getLocation());
}
}
示例7: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
NameIDType nameID = (NameIDType) samlObject;
if (nameID.getNameQualifier() != null) {
domElement.setAttributeNS(null, NameID.NAME_QUALIFIER_ATTRIB_NAME, nameID.getNameQualifier());
}
if (nameID.getSPNameQualifier() != null) {
domElement.setAttributeNS(null, NameID.SP_NAME_QUALIFIER_ATTRIB_NAME, nameID.getSPNameQualifier());
}
if (nameID.getFormat() != null) {
domElement.setAttributeNS(null, NameID.FORMAT_ATTRIB_NAME, nameID.getFormat());
}
if (nameID.getSPProvidedID() != null) {
domElement.setAttributeNS(null, NameID.SPPROVIDED_ID_ATTRIB_NAME, nameID.getSPProvidedID());
}
}
示例8: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
ContactPerson person = (ContactPerson) samlObject;
if (person.getType() != null) {
domElement.setAttributeNS(null, ContactPerson.CONTACT_TYPE_ATTRIB_NAME, person.getType().toString());
}
Attr attribute;
for (Entry<QName, String> entry : person.getUnknownAttributes().entrySet()) {
attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
attribute.setValue(entry.getValue());
domElement.setAttributeNodeNS(attribute);
if (Configuration.isIDAttribute(entry.getKey())
|| person.getUnknownAttributes().isIDAttribute(entry.getKey())) {
attribute.getOwnerElement().setIdAttributeNode(attribute, true);
}
}
}
示例9: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
AttributeValueType attributeValue = (AttributeValueType) xmlObject;
if(!DatatypeHelper.isEmpty(attributeValue.getDataType())){
domElement.setAttributeNS(null,AttributeAssignmentType.DATA_TYPE_ATTRIB_NAME, attributeValue.getDataType());
}
Attr attribute;
for (Entry<QName, String> entry : attributeValue.getUnknownAttributes().entrySet()) {
attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
attribute.setValue(entry.getValue());
domElement.setAttributeNodeNS(attribute);
if (Configuration.isIDAttribute(entry.getKey())
|| attributeValue.getUnknownAttributes().isIDAttribute(entry.getKey())) {
attribute.getOwnerElement().setIdAttributeNode(attribute, true);
}
}
}
示例10: serializeMessage
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/**
* Serialize the SAMLObject held by the entry and store in the class.
*
* <p>This option is provided where explicit pre-serialization of the data
* is either necessary or desirable.</p>
*/
void serializeMessage() {
if (log == null) {
log = LoggerFactory.getLogger(BasicSAMLArtifactMapEntry.class);
}
if (serializedMessage == null) {
log.debug("Serializing SAMLObject to a string");
StringWriter writer = new StringWriter();
try {
XMLObjectHelper.marshallToWriter(message, writer);
} catch (MarshallingException e) {
throw new XMLRuntimeException("Error marshalling the SAMLObject: " + e.getMessage());
}
serializedMessage = writer.toString();
if (log.isTraceEnabled()) {
log.trace("Serialized SAMLObject data was:");
log.trace(serializedMessage);
}
} else {
log.debug("SAMLObject was already serialized, skipping marshall and serialize step");
}
}
示例11: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
Response response = (Response) xmlObject;
if (response.getAssertionConsumerServiceURL() != null) {
domElement.setAttributeNS(null, Response.ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME,
response.getAssertionConsumerServiceURL());
}
if (response.isSOAP11MustUnderstandXSBoolean() != null) {
XMLHelper.marshallAttribute(Response.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
response.isSOAP11MustUnderstandXSBoolean().toString(), domElement, false);
}
if (response.getSOAP11Actor() != null) {
XMLHelper.marshallAttribute(Response.SOAP11_ACTOR_ATTR_NAME,
response.getSOAP11Actor(), domElement, false);
}
}
示例12: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
Request request = (Request) xmlObject;
if (request.getProviderName() != null) {
domElement.setAttributeNS(null, Request.PROVIDER_NAME_ATTRIB_NAME, request.getProviderName());
}
if (request.isPassiveXSBoolean() != null) {
domElement.setAttributeNS(null, Request.IS_PASSIVE_NAME_ATTRIB_NAME,
request.isPassiveXSBoolean().toString());
}
if (request.isSOAP11MustUnderstandXSBoolean() != null) {
XMLHelper.marshallAttribute(Request.SOAP11_MUST_UNDERSTAND_ATTR_NAME,
request.isSOAP11MustUnderstandXSBoolean().toString(), domElement, false);
}
if (request.getSOAP11Actor() != null) {
XMLHelper.marshallAttribute(Request.SOAP11_ACTOR_ATTR_NAME,
request.getSOAP11Actor(), domElement, false);
}
}
示例13: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
AuthnStatement authnStatement = (AuthnStatement) samlObject;
if (authnStatement.getAuthnInstant() != null) {
String authnInstantStr = Configuration.getSAMLDateFormatter().print(authnStatement.getAuthnInstant());
domElement.setAttributeNS(null, AuthnStatement.AUTHN_INSTANT_ATTRIB_NAME, authnInstantStr);
}
if (authnStatement.getSessionIndex() != null) {
domElement.setAttributeNS(null, AuthnStatement.SESSION_INDEX_ATTRIB_NAME, authnStatement.getSessionIndex());
}
if (authnStatement.getSessionNotOnOrAfter() != null) {
String sessionNotOnOrAfterStr = Configuration.getSAMLDateFormatter().print(
authnStatement.getSessionNotOnOrAfter());
domElement.setAttributeNS(null, AuthnStatement.SESSION_NOT_ON_OR_AFTER_ATTRIB_NAME, sessionNotOnOrAfterStr);
}
}
示例14: marshallAttributes
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
SPSSODescriptor descriptor = (SPSSODescriptor) samlObject;
if (descriptor.isAuthnRequestsSignedXSBoolean() != null) {
domElement.setAttributeNS(null, SPSSODescriptor.AUTH_REQUESTS_SIGNED_ATTRIB_NAME, descriptor
.isAuthnRequestsSignedXSBoolean().toString());
}
if (descriptor.getWantAssertionsSignedXSBoolean() != null) {
domElement.setAttributeNS(null, SPSSODescriptor.WANT_ASSERTIONS_SIGNED_ATTRIB_NAME, descriptor
.getWantAssertionsSignedXSBoolean().toString());
}
super.marshallAttributes(samlObject, domElement);
}
示例15: checkAndMarshall
import org.opensaml.xml.io.MarshallingException; //导入依赖的package包/类
/**
* Ensure that the XMLObject is marshalled.
*
* @param xmlObject the object to check and marshall
* @throws DecryptionException thrown if there is an error when marshalling the XMLObject
*/
protected void checkAndMarshall(XMLObject xmlObject) throws DecryptionException {
Element targetElement = xmlObject.getDOM();
if (targetElement == null) {
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(xmlObject);
if (marshaller == null) {
marshaller =
Configuration.getMarshallerFactory().getMarshaller(Configuration.getDefaultProviderQName());
if (marshaller == null) {
String errorMsg = "No marshaller available for " + xmlObject.getElementQName();
log.error(errorMsg);
throw new DecryptionException(errorMsg);
}
}
try {
targetElement = marshaller.marshall(xmlObject);
} catch (MarshallingException e) {
log.error("Error marshalling target XMLObject", e);
throw new DecryptionException("Error marshalling target XMLObject", e);
}
}
}