abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Dupriez <christophe.dupr...@destin.be>
Subject Re: TargetBuilder templates key "feed" WRONG!
Date Thu, 01 Mar 2012 17:24:48 GMT
Dear James,

Thank you for your answer. For your question: I am using latest version 
of Abdera 1 (1.1.2)...

Here how looks my TargetBuilder configuration:
         // The target builder is used to construct url's for the 
various targets
         setTargetBuilder(
                 new TemplateTargetBuilder()
                 .setTemplate(TargetType.TYPE_SERVICE, "{target_base}/")
                 .setTemplate(TargetType.TYPE_COLLECTION, 
"{target_base}/{collection}{-opt|?|"+PARAM_LIST+"}{-join|&|"+PARAM_LIST+"}")
                 .setTemplate("feed", 
"{target_base}/{collection}{-opt|?|"+PARAM_LIST+"}{-join|&|"+PARAM_LIST+"}")
                 .setTemplate(TargetType.TYPE_CATEGORIES, 
"{target_base}/{collection};categories")
                 .setTemplate(TargetType.TYPE_ENTRY, 
"{target_base}/{collection}({entry})")
                 .setTemplate(TYPE_ENTRY_LINKS, 
"{target_base}/{collection}({entry})/$links/{navigation}")
                 
.setTemplate(OpenSearchTargetTypes.OPENSEARCH_DESCRIPTION, 
"{target_base}/opensearch.xml")
                 .setTemplate(OpenSearchTargetTypes.OPENSEARCH_URL, 
"{target_base}/{collection}{-opt|?|"+PARAM_LIST+"}{-join|&|"+PARAM_LIST+"}")
                 );
Note the template associated with key "feed" ! Nothing works without that!

I am experimenting with OData.org . Trying to make a basic support, here 
is my Resolver configuration:
         setTargetResolver(
                 new RegexTargetResolver()
                 .setPattern('/'+base+"/?", TargetType.TYPE_SERVICE)
                 .setPattern('/'+base+"/opensearch\\.xml(#.*)?", 
OpenSearchTargetTypes.OPENSEARCH_DESCRIPTION)
                 .setPattern('/'+base+"/?\\?[^#]*(#.*)?", 
OpenSearchTargetTypes.OPENSEARCH_URL)
                 .setPattern('/'+base+"/([^/#?;()]+);categories(#.*)?", 
TargetType.TYPE_CATEGORIES, BasicProvider.PARAM_FEED)
                 .setPattern('/'+base+"/([^/#?;()]+)(\\?[^#]*)(#.*)?", 
OpenSearchTargetTypes.OPENSEARCH_URL, BasicProvider.PARAM_FEED)
                 .setPattern('/'+base+"/([^/#?;()]+)(#.*)?", 
TargetType.TYPE_COLLECTION, BasicProvider.PARAM_FEED)
                 
.setPattern('/'+base+"/([^/#?;()]+)\\(([^/#?()]+)\\)(#.*)?", 
TargetType.TYPE_ENTRY, BasicProvider.PARAM_FEED, BasicProvider.PARAM_ENTRY)
                 .setPattern('/'+base+"/([^/#?;()]+)/([^/#?()]+)(#.*)?", 
TargetType.TYPE_ENTRY, BasicProvider.PARAM_FEED, BasicProvider.PARAM_ENTRY)
                 
.setPattern('/'+base+"/([^/#?;()]+)\\(([^/#?)]+)\\)/\\$links/([^/#\\?\\)]+)(\\?[^#]*)?(#.*)?",

TYPE_ENTRY_LINKS, BasicProvider.PARAM_FEED, 
BasicProvider.PARAM_ENTRY,"navigation")
                 );
Here also, I changed "collection" by BasicProvider.PARAM_FEED and 
"entry" by BasicProvider.PARAM_ENTRY...
* base is something like "records.svc"...
* $links is an interesting concept: still to be implemented!
* site http://www.regexplanet.com/simple/index.html is essential to test 
those patterns !

Please advise me about taking immediately (or not) the Abdera 2 train...
(I need to deliver rapidly something good for the long term!)

Have a nice day!

Christophe

Le 1/03/2012 17:26, James M Snell a écrit :
> Is this is Abdera 1.x or the refactored stuff in abdera2-server?
>
> On Wed, Feb 29, 2012 at 2:59 AM, Christophe Dupriez
> <christophe.dupriez@destin.be>  wrote:
>> Hi!
>>
>> I just lost a few hours on this:
>>
>> In AbstractCollectionAdapter, you have:
>>
>>     public String getHref(RequestContext request) {
>>         return request.urlFor("feed", hrefParams);
>>     }
>>
>> In most Abdera code and examples, you have setTargetBuilder(new
>> TemplateBuilder() ... .setTemplate(TargetType.TYPE_COLLECTION) ... )
>> TargetType.TYPE_COLLECTION is not at all "feed" !!!
>>
>> Any explanation? A committer would open a JIRA issue on this?
>>
>> Thanks!
>>
>> Christophe
>


Mime
View raw message