Hi,
I'm using Jersey a Java Framework for making REST calls to external API's I know, I'm sorry.
Jersey is a massive pain in the ass when it does not get the right Content-Type back from the server, in your case is gets back text/plain, refusing any unmarshalling. I've tried a few hacks of varying degrees of nastiness and there is no clean fix for this.
Out of boredom I checked the code in /usr/libexec/webmin/virtual-server/remote.cgi and found you can replace
print "Content-type: text/plain\n\n";
with
if($format == "xml") { print "Content-type: application/xml\n\n"; } else { if($format == "json") { print "Content-type: application/json\n\n"; } else { print "Content-type: text/plain\n\n"; } }
Sorry, not the best of perl. Basically what it does is force the Content Type to be consistent with the requested data type. I can appreciate that not everbody would like this change, but I'm sharing it in the hopes you'll consider changing the current behaviour.
For now I'll just patch my own instances with this.
Comments
Submitted by JamieCameron on Mon, 10/21/2013 - 10:45 Comment #1
Thanks for pointing this out - the next Virtualmin release (4.04) will set the correct MIME type.
Submitted by Issues on Mon, 11/04/2013 - 13:31 Comment #2
Automatically closed -- issue fixed for 2 weeks with no activity.