Reference and reference list
I am looking for reference and reference list guidance, examples ( I think). At the first level of my service my URI pattern is simply AT the root my service is simply "/{type}"; In the root of my service I just started creating I would like to return a list of links to all available types. I would like the list to have a title and each link to have some descriptive label. I will need to do it in html and xml, but lets concentrate on html. Before starting to craft my HTML and XML "by hand" I looked around and looks to me ReferenceList is a good candidate to help. So in my Resource.represent I do something like: ReferenceList rl = new ReferenceList(); for (int i = 0; i < supportedTypes.length; i++) { Reference url = new Reference(getRequest().getRootRef()); url.addSegment(supportedTypes[i]); rl.add(url); } return rl.getWebRepresentation(); Any hints, example or doc pointes would be highly appreciated. I tried, but I think I do not understand the concepts I am dealing with. I would like to make it more informative, with the page title (instead of "List of references"), labels, the text for each URI, instead of dry URI. Here is what I get now: List of references http://localhost:9080/myrest/Type1 http://localhost:9080/myrest/Type2 ... I would like to get at least: List of links for lists of items of a specific type Type1 Type2 ... With URIs in the source.
Re: Reference and reference list
Hello Leshek, I'm not sure the ReferenceList object is really helpful for you. You can either code your representations (HTML and XML) manually or use one of the templated representations (freemarker, velocity) or one of the XML-related representations (JIBX, JAXB). best regards, Thierry Boileau On Wed, Mar 5, 2008 at 8:18 AM, Leshek <[EMAIL PROTECTED]> wrote: > I am looking for reference and reference list guidance, examples ( I think). > > At the first level of my service my URI pattern is simply AT the root my > service is simply "/{type}"; > > In the root of my service I just started creating I would like to return a > list of links to all available types. I would like the list to have a title > and each link to have some descriptive label. I will need to do it in html > and xml, but lets concentrate on html. Before starting to craft my HTML and > XML "by hand" I looked around and looks to me ReferenceList is a good > candidate to help. > > So in my Resource.represent I do something like: > ReferenceList rl = new ReferenceList(); > for (int i = 0; i < supportedTypes.length; i++) { > Reference url = new Reference(getRequest().getRootRef()); > url.addSegment(supportedTypes[i]); >rl.add(url); > } > return rl.getWebRepresentation(); > > Any hints, example or doc pointes would be highly appreciated. I tried, but > I think I do not understand the concepts I am dealing with. > > I would like to make it more informative, with the page title (instead of > "List of references"), labels, the text for each URI, instead of dry URI. > > Here is what I get now: > > List of references > http://localhost:9080/myrest/Type1 > http://localhost:9080/myrest/Type2 > ... > > > I would like to get at least: > > List of links for lists of items of a specific type > Type1 > Type2 > ... > > > With URIs in the source. > > > >
RE: Reference and reference list
Hi all, A good compromise would be to create a ReferenceList subclass, overriding the getWebRepresentation() method to return a FreeMarker TemplateRepresentation instance for example where you could control the content as you which. Best regards, Jerome > -Message d'origine- > De : Thierry Boileau [mailto:[EMAIL PROTECTED] > Envoyé : mercredi 5 mars 2008 09:23 > À : discuss@restlet.tigris.org > Objet : Re: Reference and reference list > > Hello Leshek, > > I'm not sure the ReferenceList object is really helpful for you. > You can either code your representations (HTML and XML) manually or > use one of the templated representations (freemarker, velocity) or one > of the XML-related representations (JIBX, JAXB). > > best regards, > Thierry Boileau > > On Wed, Mar 5, 2008 at 8:18 AM, Leshek <[EMAIL PROTECTED]> wrote: > > I am looking for reference and reference list guidance, > examples ( I think). > > > > At the first level of my service my URI pattern is simply > AT the root my > > service is simply "/{type}"; > > > > In the root of my service I just started creating I would > like to return a > > list of links to all available types. I would like the > list to have a title > > and each link to have some descriptive label. I will need > to do it in html > > and xml, but lets concentrate on html. Before starting to > craft my HTML and > > XML "by hand" I looked around and looks to me > ReferenceList is a good > > candidate to help. > > > > So in my Resource.represent I do something like: > > ReferenceList rl = new ReferenceList(); > > for (int i = 0; i < supportedTypes.length; i++) { > > Reference url = new Reference(getRequest().getRootRef()); > > url.addSegment(supportedTypes[i]); > >rl.add(url); > > } > > return rl.getWebRepresentation(); > > > > Any hints, example or doc pointes would be highly > appreciated. I tried, but > > I think I do not understand the concepts I am dealing with. > > > > I would like to make it more informative, with the page > title (instead of > > "List of references"), labels, the text for each URI, > instead of dry URI. > > > > Here is what I get now: > > > > List of references > > http://localhost:9080/myrest/Type1 > > http://localhost:9080/myrest/Type2 > > ... > > > > > > I would like to get at least: > > > > List of links for lists of items of a specific type > > Type1 > > Type2 > > ... > > > > > > With URIs in the source. > > > > > > > >