Off the top of my head, something like:
@Path("apath")
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Workshop> getWorkshops() {...return a list...}
...client side WebTarget...
List<Workshop> workshops =
webTarget.request(MediaType.APPLICATION_JSON).get().readEntity(new
GenericType<List<Workshop>>() {});
Andy.
On 2 August 2016 at 07:27, mauro2java2011 <mauro2java2011@gmail.com> wrote:
> Esvuse but for instantiation the operator is new () not {}
> Il 02/ago/2016 02:11, "John D. Ament-2 [via TomEE & OpenEJB]" <
> ml-node+s979440n4679567h52@n4.nabble.com> ha scritto:
>
> > GenericEntity is an abstract class. You're instantiating an anonymous
> > instance of it.
> >
> > On Mon, Aug 1, 2016 at 8:06 PM mauro2java2011 <[hidden email]
> > <http:///user/SendEmail.jtp?type=node&node=4679567&i=0>>
> > wrote:
> >
> > > I try to understand how return a collection of object as response with
> > rest
> > >
> > >
> > >
> > >
> > > import javax.ws.rs.core.GenericEntity;
> > > //...
> > > @GET
> > > public Response workshops() {
> > > List<Workshop> workshops = ...//a list of entities
> > > GenericEntity<List<Workshop>> l
> > > ist = new GenericEntity<List<Workshop>>(workshops)
*{}*;
> > > return Response.ok(list).build();
> > > }
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/signify-of-when-i-create-a-rest-Response-with-a-List-tp4679566.html
> > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > >
> >
> >
> > ------------------------------
> > If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://tomee-openejb.979440.n4.nabble.com/signify-of-when-i-create-a-rest-Response-with-a-List-tp4679566p4679567.html
> > To unsubscribe from signify of {} when i create a rest Response with a
> > List, click here
> > <
> http://tomee-openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4679566&code=bWF1cm8yamF2YTIwMTFAZ21haWwuY29tfDQ2Nzk1NjZ8LTExMTcxODc2MjU=
> >
> > .
> > NAML
> > <
> http://tomee-openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/signify-of-when-i-create-a-rest-Response-with-a-List-tp4679566p4679568.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
--
Andy Gumbrecht
https://twitter.com/AndyGeeDe
http://www.tomitribe.com
|