dev@jersey.java.net

Re: Invalid media type

From: Fred <frederic.auguste_at_gmail.com>
Date: Fri, 27 Jul 2007 12:06:57 +0200

Yes, I have a [java.text.ParseException].

You can reproduce this bug with the following code :
MediaTypeProvider mediaTypeProvider = new MediaTypeProvider();
mediaTypeProvider.fromString("multipart/form-data;
boundary=Thread:0000_at_Round:0001");

Stak trace :
java.text.ParseException: Expected separator ';' instead of ':'
        at com.sun.ws.rest.impl.http.header.reader.HttpHeaderReader.nextSeparator(HttpHeaderReader.java:87)
        at com.sun.ws.rest.impl.http.header.reader.HttpHeaderReader.readParameters(HttpHeaderReader.java:215)
        at com.sun.ws.rest.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:73)

Frédéric

2007/7/27, Jakub Podlesak <Jakub.Podlesak_at_sun.com>:
>
> Hi Fred,
>
> by any chance, do you see a [java.text.ParseException]
> somewhere around in your log?
>
> Maybe it would help if you could provide your service/client
> source code. You could attach it to a bug report, if you submitted
> a new one at https://jersey.dev.java.net/issues/
>
> Many thanks,
>
> ~Jakub
>
> On Fri, Jul 27, 2007 at 09:49:21AM +0200, Fred wrote:
> > Jakub,
> >
> > See below my stak trace :
> >
> > java.lang.IllegalArgumentException: Invalid media type:
> > multipart/form-data; boundary=Thread:0000_at_Round:0001
> > javax.ws.rs.core.MediaType.&lt;init&gt;(MediaType.java:84)
> > com.sun.ws.rest.impl.model.HttpHelper.getContentType(HttpHelper.java:110)
> > com.sun.ws.rest.impl.model.HttpHelper.getContentType(HttpHelper.java:99)
> > com.sun.ws.rest.impl.model.method.ResourceMethodMapDispatcher.dispatch(ResourceMethodMapDispatcher.java:69)
> > com.sun.ws.rest.impl.model.BaseResourceClass.dispatch(BaseResourceClass.java:68)
> > com.sun.ws.rest.impl.application.WebApplicationContext.dispatchTo(WebApplicationContext.java:102)
> > com.sun.ws.rest.impl.model.ClassDispatcher.dispatch(ClassDispatcher.java:43)
> > com.sun.ws.rest.impl.model.BaseResourceClass.dispatch(BaseResourceClass.java:68)
> > com.sun.ws.rest.impl.model.RootResourceClass.dispatch(RootResourceClass.java:122)
> > com.sun.ws.rest.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:156)
> > com.sun.ws.rest.impl.container.servlet.ServletAdaptor.service(ServletAdaptor.java:130)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >
> > Fred
> >
> > Hi Fred,
> >
> > could you please provide the exception stack trace (perhaps from your
> > server log)?
> >
> > Thanks,
> >
> > ~Jakub
> >
> >
> > 2007/7/26, Fred <frederic.auguste_at_gmail.com>:
> > > Hi,
> > >
> > > I am working with jersey 0.2.
> > >
> > > I defined a resource with these anotations :
> > > @HttpMethod("POST")
> > > @UriTemplate("/{version}/{toto}")
> > > @ConsumeMime("multipart/form-data")
> > > @ProduceMime("application/atom+xml")
> > >
> > >
> > > When I send a request with the following content-type in my request header
> > > Content-Type: multipart/form-data; boundary=Thread:0000_at_Round:0001
> > > I have the following error :
> > > java.lang.IllegalArgumentException : Invalid media type: multipart/form-data; boundary=Thread:0000_at_Round:0001
> > >
> > > If I use the following content-type in the header, the response is correct.
> > > Content-Type: multipart/form-data; boundary=GbSqW2a9GNsRqKSfkfYTN346mgofBgm0uUa4_slb
> > >
> > > Is my content type is wrong or is it a bug in jersey ?
> > >
> > > Thanks for your response.
> > >
> > > Best regards,
> > > Frédéric
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: dev-help_at_jersey.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net
>
>