Sorry Johan, I'm not sure what you're asking :(

- Can we do anything on the CXF server side to make JSR311 chose CXF?
- Can we ask Sun/Oracle to see if they can do anything about the invalid
MediaType being sent in the HttpUrlConnection
- ...something else?

-kl

On Mon, Jan 30, 2012 at 6:29 PM, Johan Edstrom <[email protected]> wrote:

> Even more interestingly - how do we fix it? :)
>
> On Jan 30, 2012, at 7:26 PM, K Fung wrote:
>
> > Hi Stephan,
> >
> > (this e-mail is based off revision 14 of your source code, da71e69dfdcd)
> >
> > I have some good news and bad news. The good news is that I have a
> > workaround that can make all of your parameterized tests pass. The bad
> news
> > is that CXF and Jersey binaries are indeed getting mixed up when you run
> > these tests.
> >
> > For the workaround, In JerseyTestClient, change your getResource method
> so
> > that it looks like the following:
> >
> >  public String getResource(URI uri) {
> >    JerseyTestClient.LOGGER.debug("getResource(), uri = " + uri);
> >    WebResource webResource = new Client().resource(uri);
> >    return webResource.accept(MediaType.WILDCARD_TYPE).get(String.class);
> >  }
> >
> > By sending an explicit Accept header, this will block HttpUrlConnection
> > from sending an invalid header to CXF. CXF was (correctly!) spitting out
> a
> > 406 when the HttpUrlConnection was sending:
> >
> > text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
> >
> > (I'm not sure why HttpUrlConnection was sending this invalid accept. I
> > didn't drill down into this too deeply. Perhaps the JDK team can tell us
> > why).
> >
> > This would obviously imply that your test clients should always be
> sending
> > an Accept header but this shouldn't be too much of a burden for you (and
> it
> > seems you've already done it in the latest version of CxfTestClient).
> >
> > Nevertheless, as I feared, CXF and Jersey code are getting mixed up on
> the
> > server-side. You can see this in the stack:
> >
> > 012-01-30 17:40:18,785 DEBUG [qtp525030058-29]
> > org.apache.cxf.phase.PhaseInterceptorChain: Invoking handleMessage on
> > interceptor org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor@1ff61bcf
> > java.lang.IllegalArgumentException: Error parsing media type '*; q=.2'
> > at
> >
> com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:77)
> > at
> >
> com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:50)
> > at javax.ws.rs.core.MediaType.valueOf(MediaType.java:119)
> > at
> >
> org.apache.cxf.jaxrs.utils.JAXRSUtils.parseMediaTypes(JAXRSUtils.java:1097)
> > at
> >
> org.apache.cxf.jaxrs.utils.JAXRSUtils.sortMediaTypes(JAXRSUtils.java:1189)
> > at
> >
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:136)
> > at
> >
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:88)
> > at
> >
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
> > at
> >
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:123)
> > at
> >
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:206)
> > at
> >
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)
> > at
> >
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154)
> > at
> >
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:126)
> > at
> >
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
> > at
> >
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:112)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> > at
> >
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
> > at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538)
> > at
> >
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:478)
> > at
> >
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
> > at
> >
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940)
> > at
> > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
> > at
> >
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
> > at
> >
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874)
> > at
> >
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
> > at
> >
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
> > at
> >
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
> > at org.eclipse.jetty.server.Server.handle(Server.java:349)
> > at
> >
> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441)
> > at
> >
> org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:919)
> > at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:582)
> > at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:218)
> > at
> >
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:52)
> > at
> >
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)
> > at
> >
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)
> > at
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
> > at
> >
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
> > at java.lang.Thread.run(Thread.java:662)
> > Caused by: java.text.ParseException: Expected separator '/' instead of
> ';'
> > at
> >
> com.sun.jersey.core.header.reader.HttpHeaderReader.nextSeparator(HttpHeaderReader.java:112)
> > at
> >
> com.sun.jersey.core.impl.provider.header.MediaTypeProvider.valueOf(MediaTypeProvider.java:88)
> > at
> >
> com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:75)
> > ... 37 more
> >
> > Regards,
> > kl
> >
> > P.S. I assume you deliberately wanted a Jersey client to connect to a CXF
> > server.
>
>

Reply via email to