dimanche 2 août 2015

How would I be able to pass a javax.ws.rs.PathParam to a superclass, preferably without using the constructor?

I have a core implementation of how my resources should work.

@GET
@Path("/{id}")
public T get(@Auth UserCredentials user,
             @PathParam("id") String id) throws     ObjectNotFoundException {
    Optional<T> t = repository.findById(id);
    if(!t.isPresent())
        throw new ObjectNotFoundException("The database does not contain 
                                           a model with this id:" + id);
    return t.get();
}

This is subclassed by most of my resources. The issue I'm having is that the {id} is not being exported. In fact PathParam resolves like this.

javassist.tools.rmi.ObjectNotFoundException: The database does not 
contain a model with this id:55be59b8e4b08e071af12dba is not exported

How would I get around this?

Aucun commentaire:

Enregistrer un commentaire