You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Michael Sparer <mi...@gmx.at> on 2008/02/04 12:42:03 UTC

wicketstuff rome and mounting resources

Hi, 

I'm using wicketstuff-rome to create and add RSS feeds to certain pages of
my webapplication. The problem I'm now facing is that the feeds do not have
nice URLs as they're in the format e.g.
http://www.foo.bar/resources/org.apache.wicket.Application/myFeed. It would
be much better to just have them like http://www.foo.bar/feeds/myFeed. I add
the feed to the page like that:

			add(FeedResource.autodiscoveryLink(new ResourceReference("myFeed") {

				private static final long serialVersionUID = 1L;

				@Override
				protected Resource newResource() {
					return new UserFeedResource(currentUser);
				}

			}));
As myFeed needs a session-dependent parameter (currentUser), I can't just
mount the resource by using mountsharedresource in the application class.
I had a look at a recent post in the mailinglist
(http://www.nabble.com/Mounting-shared-resources-to15230311.html), but I
wondered if they're might be an easier way, as I'd like to use the
autodiscoveryLink method to add the resources.

thanks in advance

Michael

-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: http://www.nabble.com/wicketstuff-rome-and-mounting-resources-tp15266406p15266406.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicketstuff rome and mounting resources

Posted by Michael Sparer <mi...@gmx.at>.
Hi Johan, 

thanks for the quick reply and your suggestions, yepp you're right
especially by saying that's a dangerous thing ... watching superbowl sunday
in europe definitely had an impact on my programming skills today (yes I'm
looking for an excuse for that error in reasoning :-))

regards

Michael



Johan Compagner wrote:
> 
> what you do there seems dangerous to me
> 
> especially the line:
> 
>  protected Resource newResource() {
>                                        return new
> UserFeedResource(currentUser);
>                                }
> 
> currentUser??
> 
> Is that the session specific thing?
> that looks a bit weird because if a ResourceReference is binded to the
> SharedResources
> then it first checks if there is a Resource for that reference (and
> reference is class,name,locale and style combo)
> 
> So for the second user the first resource will be found...
> 
> What you should do is add that UserFeedResource as a shared resource:
> 
> application.getSharedResources().add("myFeed",new UserFeedResource());
> 
> Then mount it if you like with the
> 
> SharedResourceRequestTargetUrlCodingStrategy("myFeed", "myFeed")
> (then you get a url like "/resources/myFeed")
> 
> 
> then in your UserFeedResource you lookup the session and get the current
> user from there.
> 
> you can stil use the: FeedResource.autodiscoveryLink(new
> ResourceReference("myFeed")
> 
> to add a reference to that feed.
> 
> johan
> 
> 
> On Feb 4, 2008 12:42 PM, Michael Sparer <mi...@gmx.at> wrote:
> 
>>
>> Hi,
>>
>> I'm using wicketstuff-rome to create and add RSS feeds to certain pages
>> of
>> my webapplication. The problem I'm now facing is that the feeds do not
>> have
>> nice URLs as they're in the format e.g.
>> http://www.foo.bar/resources/org.apache.wicket.Application/myFeed. It
>> would
>> be much better to just have them like http://www.foo.bar/feeds/myFeed. I
>> add
>> the feed to the page like that:
>>
>>                        add(FeedResource.autodiscoveryLink(new
>> ResourceReference("myFeed") {
>>
>>                                private static final long serialVersionUID
>> = 1L;
>>
>>                                @Override
>>                                protected Resource newResource() {
>>                                        return new
>> UserFeedResource(currentUser);
>>                                }
>>
>>                        }));
>> As myFeed needs a session-dependent parameter (currentUser), I can't just
>> mount the resource by using mountsharedresource in the application class.
>> I had a look at a recent post in the mailinglist
>> (http://www.nabble.com/Mounting-shared-resources-to15230311.html), but I
>> wondered if they're might be an easier way, as I'd like to use the
>> autodiscoveryLink method to add the resources.
>>
>> thanks in advance
>>
>> Michael
>>
>> -----
>> Michael Sparer
>> http://talk-on-tech.blogspot.com
>> --
>> View this message in context:
>> http://www.nabble.com/wicketstuff-rome-and-mounting-resources-tp15266406p15266406.html
>> Sent from the Wicket - User mailing list archive at
>> Nabble.com<http://nabble.com/>
>> .
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: http://www.nabble.com/wicketstuff-rome-and-mounting-resources-tp15266406p15267599.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicketstuff rome and mounting resources

Posted by Johan Compagner <jc...@gmail.com>.
what you do there seems dangerous to me

especially the line:

 protected Resource newResource() {
                                       return new
UserFeedResource(currentUser);
                               }

currentUser??

Is that the session specific thing?
that looks a bit weird because if a ResourceReference is binded to the
SharedResources
then it first checks if there is a Resource for that reference (and
reference is class,name,locale and style combo)

So for the second user the first resource will be found...

What you should do is add that UserFeedResource as a shared resource:

application.getSharedResources().add("myFeed",new UserFeedResource());

Then mount it if you like with the

SharedResourceRequestTargetUrlCodingStrategy("myFeed", "myFeed")
(then you get a url like "/resources/myFeed")


then in your UserFeedResource you lookup the session and get the current
user from there.

you can stil use the: FeedResource.autodiscoveryLink(new
ResourceReference("myFeed")

to add a reference to that feed.

johan


On Feb 4, 2008 12:42 PM, Michael Sparer <mi...@gmx.at> wrote:

>
> Hi,
>
> I'm using wicketstuff-rome to create and add RSS feeds to certain pages of
> my webapplication. The problem I'm now facing is that the feeds do not
> have
> nice URLs as they're in the format e.g.
> http://www.foo.bar/resources/org.apache.wicket.Application/myFeed. It
> would
> be much better to just have them like http://www.foo.bar/feeds/myFeed. I
> add
> the feed to the page like that:
>
>                        add(FeedResource.autodiscoveryLink(new
> ResourceReference("myFeed") {
>
>                                private static final long serialVersionUID
> = 1L;
>
>                                @Override
>                                protected Resource newResource() {
>                                        return new
> UserFeedResource(currentUser);
>                                }
>
>                        }));
> As myFeed needs a session-dependent parameter (currentUser), I can't just
> mount the resource by using mountsharedresource in the application class.
> I had a look at a recent post in the mailinglist
> (http://www.nabble.com/Mounting-shared-resources-to15230311.html), but I
> wondered if they're might be an easier way, as I'd like to use the
> autodiscoveryLink method to add the resources.
>
> thanks in advance
>
> Michael
>
> -----
> Michael Sparer
> http://talk-on-tech.blogspot.com
> --
> View this message in context:
> http://www.nabble.com/wicketstuff-rome-and-mounting-resources-tp15266406p15266406.html
> Sent from the Wicket - User mailing list archive at Nabble.com<http://nabble.com/>
> .
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>