List of usage examples for javax.xml.bind Marshaller marshal
public void marshal(Object jaxbElement, javax.xml.stream.XMLEventWriter writer) throws JAXBException;
From source file:com.savoirtech.jaxb.engine.PooledMarshaller.java
public void marshal(Object o, Writer writer) { Marshaller marshaller = null; try {//from www .ja v a 2 s. c o m marshaller = (Marshaller) (pool.borrowObject()); marshaller.marshal(o, writer); } catch (Exception e) { LOG.error("Could not marshal code ", e); } finally { try { if (null != marshaller) { pool.returnObject(marshaller); } } catch (Exception e) { // ignored } } }
From source file:com.savoirtech.jaxb.engine.PooledMarshaller.java
public void marshal(Object o, ContentHandler contentHandler) { Marshaller marshaller = null; try {//from w w w . j a v a2s. c o m marshaller = (Marshaller) (pool.borrowObject()); marshaller.marshal(o, contentHandler); } catch (Exception e) { LOG.error("Could not marshal code ", e); } finally { try { if (null != marshaller) { pool.returnObject(marshaller); } } catch (Exception e) { // ignored } } }
From source file:com.savoirtech.jaxb.engine.PooledMarshaller.java
public void marshal(Object o, Node node) { Marshaller marshaller = null; try {// w w w . j av a2 s . c om marshaller = (Marshaller) (pool.borrowObject()); marshaller.marshal(o, node); } catch (Exception e) { LOG.error("Could not marshal code ", e); } finally { try { if (null != marshaller) { pool.returnObject(marshaller); } } catch (Exception e) { // ignored } } }
From source file:com.savoirtech.jaxb.engine.PooledMarshaller.java
public void marshal(Object o, XMLStreamWriter xmlStreamWriter) { Marshaller marshaller = null; try {/*from w w w . ja v a 2 s. c om*/ marshaller = (Marshaller) (pool.borrowObject()); marshaller.marshal(o, xmlStreamWriter); } catch (Exception e) { LOG.error("Could not marshal code ", e); } finally { try { if (null != marshaller) { pool.returnObject(marshaller); } } catch (Exception e) { // ignored } } }
From source file:com.savoirtech.jaxb.engine.PooledMarshaller.java
public void marshal(Object o, XMLEventWriter xmlEventWriter) { Marshaller marshaller = null; try {//from w w w. j a v a2 s . c om marshaller = (Marshaller) (pool.borrowObject()); marshaller.marshal(o, xmlEventWriter); } catch (Exception e) { LOG.error("Could not marshal code ", e); } finally { try { if (null != marshaller) { pool.returnObject(marshaller); } } catch (Exception e) { // ignored } } }
From source file:org.jvoicexml.callmanager.mmi.http.HttpETLProtocolAdapter.java
@Override public void sendMMIEvent(Object channel, Mmi mmi) throws IOException { try {//from w w w. j av a 2 s .c om final URI source = server.getURI(); final LifeCycleEvent event = mmi.getLifeCycleEvent(); event.setSource(source.toString()); final String target = event.getTarget(); if (target == null) { LOGGER.error("unable to send MMI event '" + mmi + "'. No target."); return; } final JAXBContext ctx = JAXBContext.newInstance(Mmi.class); final Marshaller marshaller = ctx.createMarshaller(); final ByteArrayOutputStream out = new ByteArrayOutputStream(); marshaller.marshal(mmi, out); final URI uri = new URI(target); final HttpClient client = new DefaultHttpClient(); final HttpPost post = new HttpPost(uri); final HttpEntity entity = new StringEntity(out.toString(), ContentType.APPLICATION_XML); post.setEntity(entity); client.execute(post); LOGGER.info("sending " + mmi + " to '" + uri + "'"); } catch (JAXBException e) { throw new IOException(e.getMessage(), e); } catch (URISyntaxException e) { throw new IOException(e.getMessage(), e); } }
From source file:be.fedict.eid.pkira.xkmsws.util.XMLMarshallingUtil.java
public Document marshalBulkRegisterTypeToDocument(BulkRegisterType bulkRegisterType) throws XKMSClientException { QName qname = new QName("http://www.w3.org/2002/03/xkms-xbulk", "BulkRegister"); JAXBElement<BulkRegisterType> jaxbElement = new JAXBElement<BulkRegisterType>(qname, BulkRegisterType.class, bulkRegisterType);// w w w .ja v a2 s.co m try { Document doc = documentBuilder.newDocument(); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.marshal(jaxbElement, doc); return doc; } catch (JAXBException e) { throw new XKMSClientException("Cannot marshal message.", e); } }
From source file:com.mijao.poc.jaxb.PooledMarshaller.java
public void marshal(Object o, OutputStream os) { Marshaller marshaller = null; try {/*from w ww . ja v a 2s. c o m*/ marshaller = (Marshaller) (pool.borrowObject()); marshaller.marshal(o, os); } catch (Exception e) { logger.error("Could not marshal code ", e); } finally { try { if (null != marshaller) { pool.returnObject(marshaller); } } catch (Exception e) { // ignored } } }
From source file:com.mijao.poc.jaxb.PooledMarshaller.java
public void marshal(Object o, Result res) { Marshaller marshaller = null; try {//w ww .j a v a 2 s.c om marshaller = (Marshaller) (pool.borrowObject()); marshaller.marshal(o, res); } catch (Exception e) { logger.error("Could not marshal code ", e); } finally { try { if (null != marshaller) { pool.returnObject(marshaller); } } catch (Exception e) { // ignored } } }
From source file:com.mijao.poc.jaxb.PooledMarshaller.java
public void marshal(Object o, File file) { Marshaller marshaller = null; try {/*w w w . j av a 2s. c o m*/ marshaller = (Marshaller) (pool.borrowObject()); marshaller.marshal(o, file); } catch (Exception e) { logger.error("Could not marshal code ", e); } finally { try { if (null != marshaller) { pool.returnObject(marshaller); } } catch (Exception e) { // ignored } } }