users@jersey.java.net

Re: [Jersey] Separation of Concern between Resource and Writer

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 06 Oct 2009 15:00:29 +0200

On Oct 6, 2009, at 2:51 PM, Paul Sandoz wrote:
>
> public class MyResource implements Linkable {
> // Linkable iface
> Links getLinks() { ... }
>
> @GET
> Linkable<MyBean> get() {
> MyBean b = ...
> return new Linkable<MyBean>(b)
> }
> }
>

That should be something like :

public class MyResource implements LinkResolver {
  // LinkResolver iface
  Links getLinks() { ... }

  @GET
  Linkable<MyBean> get() {
    MyBean b = ...
    return new Linkable<MyBean>(b)
  }
}


where the MBW for Linkable can obtain the instance of LinkResolver
from UriInfo.getMatchedResources.

Paul.