users@jersey.java.net

java.lang.IllegalArgumentException: Error parsing media type

From: Michael Andrews <mandrews_at_liveops.com>
Date: Tue, 16 Jun 2009 17:11:51 -0700

Hi,

I am trying to associate the MIME type "test/plain;javascript" with a JSON Provider. From the many examples I have gleaned from the mailing list and docs, I tried this:

ClientConfig config = new DefaultClientConfig(); config.getClasses().add(JSONRootElementProvider.class); Client client = Client.create(config); WebResource webResource = client.resource(uri); //webResource.accept(MediaType.APPLICATION_JSON).type("text/plain;javascript"); webResource.accept("text/plain;javascript"); String text = webResource.get(String.class);

But I get a this exception (as well as a long stack trace):

Exception in thread "main" java.lang.IllegalArgumentException: Error parsing media type 'text/plain;javascript'

Thanks for your help,

Michael