Search in sources :

Example 1 with JaxbCharacterEscapeEncoder

use of eu.bcvsolutions.idm.core.api.jaxb.JaxbCharacterEscapeEncoder in project CzechIdMng by bcvsolutions.

the class DefaultIdmScriptService method initJaxbMarshaller.

/**
 * Create instance of JaxbMarshaller and set required properties to him.
 *
 * @return
 */
private Marshaller initJaxbMarshaller() {
    Marshaller jaxbMarshaller = null;
    try {
        jaxbMarshaller = jaxbContext.createMarshaller();
        jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING, StandardCharsets.UTF_8.name());
        jaxbMarshaller.setProperty(ENCODING_HANDLER, new JaxbCharacterEscapeEncoder());
    } catch (JAXBException e) {
        throw new ResultCodeException(CoreResultCode.XML_JAXB_INIT_ERROR, e);
    }
    return jaxbMarshaller;
}
Also used : Marshaller(javax.xml.bind.Marshaller) JaxbCharacterEscapeEncoder(eu.bcvsolutions.idm.core.api.jaxb.JaxbCharacterEscapeEncoder) JAXBException(javax.xml.bind.JAXBException) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException)

Example 2 with JaxbCharacterEscapeEncoder

use of eu.bcvsolutions.idm.core.api.jaxb.JaxbCharacterEscapeEncoder in project CzechIdMng by bcvsolutions.

the class DefaultIdmNotificationTemplateService method initJaxbMarshaller.

/**
 * Create instance of JaxbMarshaller and set required properties to him.
 *
 * @return
 */
private Marshaller initJaxbMarshaller() {
    Marshaller jaxbMarshaller = null;
    try {
        jaxbMarshaller = jaxbContext.createMarshaller();
        jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING, StandardCharsets.UTF_8.name());
        jaxbMarshaller.setProperty(ENCODING_HANDLER, new JaxbCharacterEscapeEncoder());
    } catch (JAXBException e) {
        throw new ResultCodeException(CoreResultCode.XML_JAXB_INIT_ERROR, e);
    }
    return jaxbMarshaller;
}
Also used : Marshaller(javax.xml.bind.Marshaller) JaxbCharacterEscapeEncoder(eu.bcvsolutions.idm.core.api.jaxb.JaxbCharacterEscapeEncoder) JAXBException(javax.xml.bind.JAXBException) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException)

Example 3 with JaxbCharacterEscapeEncoder

use of eu.bcvsolutions.idm.core.api.jaxb.JaxbCharacterEscapeEncoder in project CzechIdMng by bcvsolutions.

the class AbstractRecoverableService method initJaxbMarshaller.

/**
 * Create instance of JaxbMarshaller and set required properties to him.
 *
 * @return
 */
protected Marshaller initJaxbMarshaller() {
    Marshaller jaxbMarshaller = null;
    try {
        jaxbMarshaller = jaxbContext.createMarshaller();
        jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING, StandardCharsets.UTF_8.name());
        jaxbMarshaller.setProperty(ENCODING_HANDLER, new JaxbCharacterEscapeEncoder());
    } catch (JAXBException e) {
        throw new ResultCodeException(CoreResultCode.XML_JAXB_INIT_ERROR, e);
    }
    return jaxbMarshaller;
}
Also used : Marshaller(javax.xml.bind.Marshaller) JaxbCharacterEscapeEncoder(eu.bcvsolutions.idm.core.api.jaxb.JaxbCharacterEscapeEncoder) JAXBException(javax.xml.bind.JAXBException) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException)

Aggregations

ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)3 JaxbCharacterEscapeEncoder (eu.bcvsolutions.idm.core.api.jaxb.JaxbCharacterEscapeEncoder)3 JAXBException (javax.xml.bind.JAXBException)3 Marshaller (javax.xml.bind.Marshaller)3