Seems like I'm a bit slow on the uptake today... ;-) Can you post a short
snippet of what you try to achieve and what the exact problem is? I mean,
you can just create a new object inside the sub-resource locator and pass a
path param as the PK into the constructor manually (or use it as a JPA query
criteria), which both is rather short and simple.
@GET @Path("{pk}")
public Pojo getPojo(@PathParam("pk") T pk) {
return new Pojo (pk);
}
@EJB SB sb;
@GET @Path("{pk}")
public SB getSb(@PathParam("pk") T pk) {
sb.setPk(pk);
return sb;
}
@GET @Path("{pk}")
public Entity getEntity(@PathParam("pk") T pk) {
return em.find(Entity.class, pk);
}
How would you like the solution to look like in terms of Java syntax? Maybe
we then see more clear the elegance you expect.
Regards
Markus
> -----Original Message-----
> From: Adam Bien [mailto:abien_at_adam-bien.com]
> Sent: Montag, 7. März 2011 20:36
> To: jsr339-experts_at_jax-rs-spec.java.net
> Subject: [jsr339-experts] Re: First steps
>
> In sub-resource locator you are usually passing an URI (from
> @PathParam).
> There is no elegant way right now to implement that with EJB 3.1.
>
> With POJOs it is not a big problem - you can pass the URI (usually a
> PK) in a constructor...
>
> Constructor injection of the current context would be nice...
>
> thanks!,
>
> adam
>
>
> On 07.03.2011, at 14:57, Bill Burke wrote:
>
> >
> >
> > On 3/6/11 4:00 AM, Adam Bien wrote:
> >> Hi Roberto,
> >>
> >> better intergration with EJB 3.2 would be also nice. E.g. it is hard
> right now to use EJB 3.2 as a sub-resource.
> >>
> >
> >
> > @EJB Sub sub;
> >
> > @Path("sub")
> > public Sub getSub() { return sub; }
> >
> > ?
> >
> > --
> > Bill Burke
> > JBoss, a division of Red Hat
> > http://bill.burkecentral.com
>