users@jersey.java.net

[Jersey] Re: Question about types

From: John Yeary <johnyeary_at_gmail.com>
Date: Wed, 11 Jan 2012 07:37:45 -0500

Hello András,

I am not sure what you were looking at, but I would use the
GenericEntity<T> to wrap your class if necessary. It would look something
like

return new GenericEntity<List<EntityDAO>>( YOUR_LIST_VARIABLE_HERE ){};
____________________________

John Yeary
____________________________

<http://javaevangelist.blogspot.com/> <https://twitter.com/jyeary>
<http://www.youtube.com/johnyeary>
  <http://www.linkedin.com/in/jyeary>
<https://plus.google.com/112146428878473069965>
  <http://www.facebook.com/jyeary>
<http://feeds.feedburner.com/JavaEvangelistJohnYearysBlog>
  <http://netbeans.org/people/84414-jyeary>
____________________________

"Far better it is to dare mighty things, to win glorious triumphs, even
though checkered by failure, than to take rank with those poor spirits who
neither enjoy much nor suffer much, because they live in the gray twilight
that knows not victory nor defeat."
-- Theodore Roosevelt



On Wed, Jan 11, 2012 at 5:15 AM, András Csányi <sayusi.ando_at_gmail.com>wrote:

> On 11 January 2012 02:22, John Yeary <johnyeary_at_gmail.com> wrote:
> >
> > Hello András,
> >
> > I have examples on my blog http://javaevangelist.blogspot.com as well
> as, links to some articles.
> > The examples have various examples of using JSON, and JSONP including
> with a database with JPA.
> >
> > Your question is fairly general, but I think that you should be able to
> handle it fairly easily if you have the entities in a library jar
> > which can be shared between the server and client. The jersey.java.netsite has good documentation. I would also suggest
> > downloading the source code, which includes a number of examples, and
> contributed examples.
> >
> > John
>
> Hi John,
>
> Thank you for your answer! I'm reading the different documentation and
> I have a notion about my issue. I have to create a class to wrap my
> datatype, do I understand correctly?
> I've read that there is not possible to use generic type in this case.
> I mean, for example List<EntityDTO>.class, to set up in in response.
> So, I think that I create an object called
> RESTEntityResponse and this class will contain my desired
> List<EntityDTO>. Is it correct by this way?
>
> By the way, my EntityDTO are shared in a particular library between
> server and client.
>
> Thanks in advance!
>
> András
>
>
> --
> - -
> -- Csanyi Andras (Sayusi Ando) -- http://sayusi.hu --
> http://facebook.com/andras.csanyi
> -- ""Trust in God and keep your gunpowder dry!" - Cromwell
>