Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected String marshallerEx(Tickets tickets) throws JAXBException {
- JAXBContext jaxbContext = JAXBContext.newInstance(Tickets.class);
- Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
- jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- StringWriter sw = new StringWriter();
- // Marshal the tickets list in console
- jaxbMarshaller.marshal(tickets, sw);
- LOGGER.info("marshal -> " + sw.toString());
- return sw.toString();
- }
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <tickets>
- <ticket>
- <assignedQueueId>61</assignedQueueId>
- <category>11</category>
- <cause>0</cause>
- <createDate>2015-08-19T13:34:18-04:00</createDate>
- <customFields/>
- </ticket>
- </tickets>
- "<?xml version="1.0" encoding="UTF-8" standalone="yes"?>n<tickets>n <ticket>n <assignedQueueId>61</assignedQueueId>n <category>11</category>n <cause>0</cause>n <createDate>2015-08-19T13:34:18-04:00</createDate>n <customFields/>n </ticket>n</tickets>n"
- HttpHeaders responseHeaders = new HttpHeaders();
- responseHeaders.set("content-type", "text/plain");
- return new ResponseEntity<String>(marshallerEx(tickets), responseHeaders, HttpStatus.OK);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement