javax.xml.bind.attachment.AttachmentMarshaller Java Examples

The following examples show how to use javax.xml.bind.attachment.AttachmentMarshaller. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OldBridge.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output,nsContext);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #2
Source File: JAXBDispatchMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void writeTo(XMLStreamWriter sw) throws XMLStreamException {
    try {
        // MtomCodec sets its own AttachmentMarshaller
        AttachmentMarshaller am = (sw instanceof MtomStreamWriter)
                ? ((MtomStreamWriter) sw).getAttachmentMarshaller()
                : new AttachmentMarshallerImpl(attachmentSet);

        // Get the encoding of the writer
        String encoding = XMLStreamWriterUtil.getEncoding(sw);

        // Get output stream and use JAXB UTF-8 writer
        OutputStream os = bridge.supportOutputStream() ? XMLStreamWriterUtil.getOutputStream(sw) : null;
        if (rawContext != null) {
            Marshaller m = rawContext.createMarshaller();
            m.setProperty("jaxb.fragment", Boolean.FALSE);
            m.setAttachmentMarshaller(am);
            if (os != null) {
                m.marshal(jaxbObject, os);
            } else {
                m.marshal(jaxbObject, sw);
            }

        } else {

            if (os != null && encoding != null && encoding.equalsIgnoreCase(SOAPBindingCodec.UTF8_ENCODING)) {
                bridge.marshal(jaxbObject, os, sw.getNamespaceContext(), am);
            } else {
                bridge.marshal(jaxbObject, sw, am);
            }
        }
        //cleanup() is not needed since JAXB doesn't keep ref to AttachmentMarshaller
    } catch (JAXBException e) {
        // bug 6449684, spec 4.3.4
        throw new WebServiceException(e);
    }
}
 
Example #3
Source File: OldBridge.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output,nsContext);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #4
Source File: OldBridge.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #5
Source File: Bridge.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #6
Source File: Bridge.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output,nsContext);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #7
Source File: Bridge.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,contentHandler);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #8
Source File: Bridge.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output,nsContext);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #9
Source File: Bridge.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output,nsContext);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #10
Source File: Bridge.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,contentHandler);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #11
Source File: JAXBDispatchMessage.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void writeTo(XMLStreamWriter sw) throws XMLStreamException {
    try {
        // MtomCodec sets its own AttachmentMarshaller
        AttachmentMarshaller am = (sw instanceof MtomStreamWriter)
                ? ((MtomStreamWriter) sw).getAttachmentMarshaller()
                : new AttachmentMarshallerImpl(attachmentSet);

        // Get the encoding of the writer
        String encoding = XMLStreamWriterUtil.getEncoding(sw);

        // Get output stream and use JAXB UTF-8 writer
        OutputStream os = bridge.supportOutputStream() ? XMLStreamWriterUtil.getOutputStream(sw) : null;
        if (rawContext != null) {
            Marshaller m = rawContext.createMarshaller();
            m.setProperty("jaxb.fragment", Boolean.FALSE);
            m.setAttachmentMarshaller(am);
            if (os != null) {
                m.marshal(jaxbObject, os);
            } else {
                m.marshal(jaxbObject, sw);
            }

        } else {

            if (os != null && encoding != null && encoding.equalsIgnoreCase(SOAPBindingCodec.UTF8_ENCODING)) {
                bridge.marshal(jaxbObject, os, sw.getNamespaceContext(), am);
            } else {
                bridge.marshal(jaxbObject, sw, am);
            }
        }
        //cleanup() is not needed since JAXB doesn't keep ref to AttachmentMarshaller
    } catch (JAXBException e) {
        // bug 6449684, spec 4.3.4
        throw new WebServiceException(e);
    }
}
 
Example #12
Source File: Bridge.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #13
Source File: OldBridge.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,contentHandler);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #14
Source File: Bridge.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,contentHandler);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #15
Source File: JAXBDispatchMessage.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void writeTo(XMLStreamWriter sw) throws XMLStreamException {
    try {
        // MtomCodec sets its own AttachmentMarshaller
        AttachmentMarshaller am = (sw instanceof MtomStreamWriter)
                ? ((MtomStreamWriter) sw).getAttachmentMarshaller()
                : new AttachmentMarshallerImpl(attachmentSet);

        // Get the encoding of the writer
        String encoding = XMLStreamWriterUtil.getEncoding(sw);

        // Get output stream and use JAXB UTF-8 writer
        OutputStream os = bridge.supportOutputStream() ? XMLStreamWriterUtil.getOutputStream(sw) : null;
        if (rawContext != null) {
            Marshaller m = rawContext.createMarshaller();
            m.setProperty("jaxb.fragment", Boolean.FALSE);
            m.setAttachmentMarshaller(am);
            if (os != null) {
                m.marshal(jaxbObject, os);
            } else {
                m.marshal(jaxbObject, sw);
            }

        } else {

            if (os != null && encoding != null && encoding.equalsIgnoreCase(SOAPBindingCodec.UTF8_ENCODING)) {
                bridge.marshal(jaxbObject, os, sw.getNamespaceContext(), am);
            } else {
                bridge.marshal(jaxbObject, sw, am);
            }
        }
        //cleanup() is not needed since JAXB doesn't keep ref to AttachmentMarshaller
    } catch (JAXBException e) {
        // bug 6449684, spec 4.3.4
        throw new WebServiceException(e);
    }
}
 
Example #16
Source File: OldBridge.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output,nsContext);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #17
Source File: Bridge.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.0.2
 */
public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output,nsContext);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #18
Source File: Bridge.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #19
Source File: OldBridge.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #20
Source File: Bridge.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #21
Source File: OldBridge.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #22
Source File: SwaRefAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public String marshal(DataHandler data) {
    if(data==null)      return null;
    AttachmentMarshaller am = XMLSerializer.getInstance().attachmentMarshaller;
    // TODO: error check
    return am.addSwaRefAttachment(data);
}
 
Example #23
Source File: RepeatedElementBridge.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void marshal(T object, OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    delegate.marshal(object, output, nsContext, am);
}
 
Example #24
Source File: BridgeWrapper.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public final void marshal(T object, XMLStreamWriter output,
        AttachmentMarshaller am) throws JAXBException {
    bridge.marshal(object, output, am);
}
 
Example #25
Source File: AbstractMarshallerImpl.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
public void setAttachmentMarshaller(AttachmentMarshaller am) {
    throw new UnsupportedOperationException();
}
 
Example #26
Source File: MockMarshaller.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Override
public void setAttachmentMarshaller(AttachmentMarshaller am) {
    // TODO Auto-generated method stub

}
 
Example #27
Source File: WrapperBridge.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void marshal(T object, OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    bridge.marshal((T) convert(object), output, nsContext, am);
}
 
Example #28
Source File: BridgeWrapper.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public void marshal(T object, OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
//              bridge.marshal((T) convert(object), output, nsContext, am);
        bridge.marshal(object, output, nsContext, am);
    }
 
Example #29
Source File: RepeatedElementBridge.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void marshal(T object, OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException {
    delegate.marshal(object, output, nsContext, am);
}
 
Example #30
Source File: WrapperBridge.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
    public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
        bridge.marshal((T) convert(object), contentHandler, am);
//              bridge.marshal(object, contentHandler, am);
    }