My application supports REST API using Wink and a JAXB provider built in to the JDK (1.6). Sometimes I receive PUT requests that contain control characters.
As far as my application is concerned, the control characters constitute a valid and meaningful input. However, the application throws the notorious exception saying that it cannot digest these characters:
Message: An invalid XML character (Unicode: 0x13) was found in the element content of the document.]
at org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider.readFrom(JAXBXmlProvider.java:107)
at org.apache.wink.server.internal.registry.ServerInjectableFactory$EntityParam.getValue(ServerInjectableFactory.java:190)
at org.apache.wink.common.internal.registry.InjectableFactory.instantiate(InjectableFactory.java:67)
at org.apache.wink.server.internal.handlers.CreateInvocationParametersHandler.handleRequest
There is probably no way to tell the JAXB provider to ignore these characters (since at some point I will have to parse the Xml, and illegal is illegal..). How can I make this work? Is there a way to instruct the Rest client to escape these characters before sending them?