On 24/07/12 21:58, bcarlson wrote:
Well, I found the issue, using RESTClient... the Content-Type of the response
was "text". Not "text/plain" or something valid, just the word "text".
So, the next question is, how can I force WebClient to ignore this issue?
At the moment, the best workaround is to register a custom CXF in
interceptor on the client side, which would replace 'text' with
'text/plain', for example,
public class ReplaceContentTypeInterceptor extends
AbstractPhaseInterceptor<Message> {
public ReplaceContentTypeInterceptor() {
this(Phase.READ);
}
public void handleMessage(Message message) throws Fault {
message.put(Message.CONTENT_TYPE, "text/plain");
}
}
WebClient needs to be created directly with JAXRSClientFactoryBean:
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
bean.getInInterceptors().add(new ReplaceContentTypeInterceptor());
bean.createWebClient();
that should do it.
In meantime I'll relax the check, the strict mode will be optionally
enabled, but by default a lax mode will be in action, where a '*'
subtype will be added to values like '*' or 'text', etc. Technically,
'text' is wrong, but the code has to be more tolerable by default
Cheers, Sergey
-Ben
--
View this message in context:
http://cxf.547215.n5.nabble.com/Media-type-separator-is-missing-how-to-troubleshoot-tp5711524p5711547.html
Sent from the cxf-user mailing list archive at Nabble.com.