You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by Reto Bachmann-Gmür <re...@apache.org> on 2013/01/13 19:34:51 UTC

500 - Response and Error unless restricting accept header

Hello

When the accept header is set to

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

I get a 500 reponse and the following errr is logged.

2013-01-13 19:27:25,639 [931211918@qtp-341460182-40] ERROR
931211918@qtp-341460182-40org.apache.wink.server.internal.handlers.FlushResultHandler
- The system
could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider
class for the org.apache.clerezza.rdf.core.impl.util.PrivilegedGraphWrapper
type and text/html mediaType.  Ensure that a
javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the
type and media type specified.

When I restrict the accept header to a format for which there is a
MessageBodyWriter things works correctly.

Is this a known problem or should I investigate further and create an issue?

Cheers,
Reto

Re: 500 - Response and Error unless restricting accept header

Posted by Luciano Resende <lu...@gmail.com>.
On Sun, Mar 17, 2013 at 10:41 AM, Reto Bachmann-Gmür <re...@apache.org> wrote:
> Hi Luciano
>
> The error occurs when the resource method has no @Produces (or
> @Produces(*/*) ) and there is no MessageBodyWriter for the first preference
> in the Accept header.
>
> Cheers,
> Reto
>

I have created a simple sample application to try to reproduce your
problem, see [1]. In this application, I defined a simple resource :

@Path("/wink379")
public class Resource {

    @GET
    @Produces(MediaType.MEDIA_TYPE_WILDCARD)
    public Response getAll() { ... }
}

And then created a simple message body writer that just output some value back.

 public void writeTo( ... ) throws IOException, WebApplicationException {
        entityStream.write("Response generated by
ResourceMessageBodyWritter".getBytes());
    }


Then used a chrome rest client extension to submit a request like :

GET http://localhost:8080/sample-jaxrs-webapp/services/wink379
Content-Type application/json
Accept           text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Authorization  xxxxx

And I get back the result from the writer :

Response generated by ResourceMessageBodyWritter

Could you please check my sandbox project and see what's different
from your scenario, and help me reproduce your issue.


[1] https://svn.apache.org/repos/asf/wink/sandbox/lresende/sample-jaxrs-webapp/

-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/

Re: 500 - Response and Error unless restricting accept header

Posted by Reto Bachmann-Gmür <re...@apache.org>.
Hi Luciano

The error occurs when the resource method has no @Produces (or
@Produces(*/*) ) and there is no MessageBodyWriter for the first preference
in the Accept header.

Cheers,
Reto

On Sun, Mar 17, 2013 at 6:18 PM, Luciano Resende <lu...@gmail.com>wrote:

> On Sun, Jan 13, 2013 at 10:34 AM, Reto Bachmann-Gmür <re...@apache.org>
> wrote:
> > Hello
> >
> > When the accept header is set to
> >
> > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> >
> > I get a 500 reponse and the following errr is logged.
> >
> > 2013-01-13 19:27:25,639 [931211918@qtp-341460182-40] ERROR
> > 931211918@qtp-341460182-40
> > org.apache.wink.server.internal.handlers.FlushResultHandler - The system
> > could not find a javax.ws.rs.ext.MessageBodyWriter or a
> DataSourceProvider
> > class for the
> org.apache.clerezza.rdf.core.impl.util.PrivilegedGraphWrapper
> > type and text/html mediaType.  Ensure that a
> > javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for
> the
> > type and media type specified.
> >
> > When I restrict the accept header to a format for which there is a
> > MessageBodyWriter things works correctly.
> >
> > Is this a known problem or should I investigate further and create an
> issue?
> >
> > Cheers,
> > Reto
>
> I was trying to reproduce the error with the trunk code, I created a
> simple resource that @produces application/xml and then used a browser
> rest client to submit a request passing the accept header you
> mentioned and it worked ok. Could you double check with trunk code and
> maybe provide more details on how I could reproduce the issue.
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>

Re: 500 - Response and Error unless restricting accept header

Posted by Luciano Resende <lu...@gmail.com>.
On Sun, Jan 13, 2013 at 10:34 AM, Reto Bachmann-Gmür <re...@apache.org> wrote:
> Hello
>
> When the accept header is set to
>
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
>
> I get a 500 reponse and the following errr is logged.
>
> 2013-01-13 19:27:25,639 [931211918@qtp-341460182-40] ERROR
> 931211918@qtp-341460182-40
> org.apache.wink.server.internal.handlers.FlushResultHandler - The system
> could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider
> class for the org.apache.clerezza.rdf.core.impl.util.PrivilegedGraphWrapper
> type and text/html mediaType.  Ensure that a
> javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the
> type and media type specified.
>
> When I restrict the accept header to a format for which there is a
> MessageBodyWriter things works correctly.
>
> Is this a known problem or should I investigate further and create an issue?
>
> Cheers,
> Reto

I was trying to reproduce the error with the trunk code, I created a
simple resource that @produces application/xml and then used a browser
rest client to submit a request passing the accept header you
mentioned and it worked ok. Could you double check with trunk code and
maybe provide more details on how I could reproduce the issue.

-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/