writer = new BufferedWriter(new FileWriter(selectedFile));
context = JAXBContext.newInstance(Book.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
m.setProperty("com.sun.xml.internal.bind.characterEscapeHandler",
new CharacterEscapeHandler() {
@Override
public void escape(char[] ch, int start, int length,
boolean isAttVal, Writer writer)
throws IOException {
writer.write(ch, start, length);
}
});also i've tried add a custom JAXBContext like is explained here:
https://automationrhapsody.com/rest-performance-problems-with-dropwizard-and-jersey-jaxb-provider/
and in the run method of my application i have this code
final Client client = new JerseyClientBuilder(environment)
.using(configuration.getJerseyClientConfiguration())
.withProvider(CustomJAXBContextConfiguration.class)
.using(environment) .build(getName());
client.property(CharacterEscapeHandler.class.getName(),new CDataCharacterEscapeHandler()) ;
environment.jersey().property(CharacterEscapeHandler.class.getName(),new CDataCharacterEscapeHandler()) ;
environment.jersey().register(client); environment.jersey().register(CustomJAXBContextConfiguration.class);
but it doesn't work either,
is there a way to add a property to the marshaller jersey in Dropwizard is using ? or how i can achieve that
thank you to all of you
--
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<message><![CDATA[ some embedded & xml</data>]]></message>
<message>\<![CDATA[Welcomsome embedded & xml</data]]>></message>
and to answer you why i need that: its because when an xml has this section it can use characters '&' without the need to be converted to & for example
so its not the same, also this end xml is going to be consumed by other system which we had no way to modify.
thanks for your answer :D
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
Hello , with CDATA i mean this adding this <![CDATA[ textvalue ]]> to a xml value like this<message><![CDATA[ some embedded & xml</data>]]></message>currently i was able to the <![CDATA[ ]]> but the problem is the still jersey jaxb in dropwizard is still escaping it so it ends up like this:<message>\<![CDATA[Welcomsome embedded & xml</data]]>></message>and to answer you why i need that: its because when an xml has this section it can use characters '&' without the need to be converted to & for exampleso its not the same, also this end xml is going to be consumed by other system which we had no way to modify.
The information contained in this e-mail may be confidential. It has been sent for the sole use of the intended recipient(s). If the reader of this message is not an intended recipient, you are hereby notified that any unauthorized review, use, disclosure, dissemination, distribution or copying of this communication, or any of its contents, is strictly prohibited. If you have received it by mistake please let us know by e-mail immediately and delete it from your system. Many thanks.
La información contenida en este mensaje puede ser confidencial. Ha sido enviada para el uso exclusivo del destinatario(s) previsto. Si el lector de este mensaje no fuera el destinatario previsto, por el presente queda Ud. notificado que cualquier lectura, uso, publicación, diseminación, distribución o copiado de esta comunicación o su contenido está estrictamente prohibido. En caso de que Ud. hubiera recibido este mensaje por error le agradeceremos notificarnos por e-mail inmediatamente y eliminarlo de su sistema. Muchas gracias.
--
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-user+unsubscribe@googlegroups.com.