Hello
Please can someone give the examples of usign the JaxbRepresentation.
I'm using following code.
new Server(Protocol.HTTP, 8182, new Restlet() {
@Override
public void handle(Request request, Response response) {
response.setEntity(new JaxbRepresentation(MediaType.TEXT_PLAIN,
"mypackage", new MyObject()));
}
}).start();
and got exception when getting JAXBContext from map of contexts.
Seems i shoud initize that map in some way.
But only place where smth is pun into contexts map is getSource() method in
JaxbRepresentation
@Override
public Source getSource() throws IOException {
try {
return new JAXBSource(getContext(), getObject());
} catch (JAXBException e) {
throw new IOException(
"JAXBException while creating the JAXBSource: "
+ e.getMessage());
}
}
So should i call this manually ?
Or most probably i'm missing some point in this.
Another issue is that JaxbRepresentaion is always procucing formatted output.
But frequently it's not needed because XML is produced only for automatic
parsing
and formatted output increases its size.
Can this be made in some configurable way ?
--
Best Regards
Evgeny K. Shepelyuk