users@jersey.java.net

Re: resources inheritance

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Tue, 11 Aug 2009 21:23:37 +0200

wow, it worked :)... but:

for generic collections I got a problem:

A message body writer for Java type, class java.util.Vector, and MIME
media type, application/xml, was not found

the code:

public abstract class PujGenericResource<T extends AbstractArenaEntity> {
        @GET
        @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
        @Path("/{offset}/{limit}")
        public Collection<T> selectAll(@PathParam("offset") int offset,
                        @PathParam("limit") int limit) {
                return getFacade().readAll(offset, limit);
        }


perhaps converting that for arrays..

2009/8/11 Felipe Gaúcho <fgaucho_at_gmail.com>:
> I guess I asked this before, but: may I create:
>
> public abstract class PujGenericResource<T extends AbstractArenaEntity> {
>        protected abstract PujEntityFacade<T> getFacade();
>
>        @PUT
>        @Consumes( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
>        @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
>        public T insert(T entity) {
>                return getFacade().create(entity);
>        }
>
> and then create a concrete subclass .. and it will work with jersey ?
>
> --
> Looking for a client application for this service:
> http://fgaucho.dyndns.org:8080/footprint-service/wadl
>



-- 
Looking for a client application for this service:
http://fgaucho.dyndns.org:8080/footprint-service/wadl