Hi Ryan - that all worked great until I needed to create a link to the feed
from my WebPage.  That page has pagination so once I click off the 1st page
I lose the ID in the URL so the getParameters().getLong("id"); line starts
failing.  Although I'm not sure why using ResourceLink causes the SyndFeed
to be created...

My solution to this whole problem involved these classes:
 - MyFeedResource extends FeedResource and creates the SyndFeed using a
particular ID that gets passed in to the constructor
 - MyFeedRequestTarget extends ResourceStreamRequestTarget and creates a new
MyFeedResource using a particular ID, passing its IResourceStream to the
super constructor
 - MyFeedRequestTargetUrlCodingStrategy gets mounted at a nice URL and
handles encoding & decoding a MyFeedRequestTarget and a particular ID
 - MyFeedLink extends Link and creates a link to the feed for a particular
ID (much like BookmarkablePageLink)
 - MyFeedHeaderContributor extends HeaderContributor and creates the
auto-discovery link of the feed for a particular ID that goes in the <head>
section

What I thought was going to be straightforward blew up into five separate
classes just to get feeds that take a parameter, can be accessed at nice
URLs, and always work in feed readers.  Can you see any way I can simplify
this?

I totally love Wicket and don't want to hate on it, it's made me orders of
magnitude more productive than any other framework has, but every time I
have to use the Resource API I want to put my head through a brick wall. 
That is definitely an area that could use some simplification & refinement
in a future release.

Thanks,
Zach




Ryan Sonnek-2 wrote:
> 
> see responses inline:
> 
> On Mon, Apr 21, 2008 at 1:07 PM, Zach Cox <[EMAIL PROTECTED]> wrote:
> 
>> I would like to have URLs for this feed something like this:
>>
>> http://site.com/feed/1234
>>
>>
> This should be possible by mounting the feed resource with a "nice" url
> from
> within your WebApplication class:
> 
> public class MyApplication extends WebApplication {
>   public void init() {
>     mountSharedResource("/view/rss", new ResourceReference("myFeed") {
>       protected FeedResource newResource() {
>         return new MyFeedResource();
>       }
>     }.getSharedResourceKey());
>   }
> }
> 
> 
> 
> 
> 
> 
> 
> 
>> That way users can add that URL to their feed readers and always get
>> the latest info for object 1234.  All of the wicketstuff-rome examples
>> I've seen seem to create the FeedResource instance once and then make
>> it a shared resource.  I'm currently doing that but the feeds seem to
>> disappear and cannot be read in a feed reader after some time.
> 
> 
> This would be a question for the wicket folks and not a wicketstuff-rome
> issue.  Is there any known limitation for feed resources?
> 
> 
> 
>> Since wicketstuff-rome provides a Resource subclass (FeedResource) and
>> not a WebPage subclass I'm confused as to how to do the following:
>>  - get bookmarkable URLs with a parameter for the feed
> 
> 
> You can grab request params by using the getParameters() method within
> your
> FeedResource
> 
> public class MyFeedResource extends FeedResource {
> 
>   protected SyndFeed getFeed() {
>     Long id = getParameters().getLong("id");
>   }
> 
> }
> 
> 
>   - have a new FeedResource created & returned when user accesses that URL
> 
> 
> need to ask the wicket folks why this isn't happening...
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Bookmarkable-RSS-feed-with-parameter-using-wicketstuff-rome-tp16816318p16819657.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to