Thanks Richard

I know this is barely brushing the surface of REST, which I why I typed 
"REST-ish" ;) My users will be very non-technical, so I want to use URLs 
that will make sense and be easy to remember, so I'm not fond of the 
mapping you suggest.

Also, competition codes will not be unique by themselves, but the will 
be unique for a given organisation (so two organisations could have 
competitions called 'tmx4'). Including the organisation code in the URI 
to retrieve the competition allows the competition to be looked up 
statelessly. This will also be a selling point - the main competitor 
requires filling in a (albeit small) form and 5 clicks just to retrieve 
the same information available by bookmarking that URI.

I've extended NameBasedActionResolver and set it up as an extension and 
added some logging. It looks like all I really need to do is override 
getActionBean(ActionBeanContext, String) to choose the correct action 
bean for the request and getUrlBindingFromPath(String) to resolve the 
correct event. Does this sound right?

Cheers

Richard Hauswald wrote:
> Hi Rob,
> I'd change the way parameters are supplied. IMHO REST means more the
> mapping controllers to human readable URL's. For the scenario you
> described I'd 2 ActionBeans: ViewOrganisationAction and
> AdminOrganisationAction and bind them to the urls /view/ and /admin/.
> So if you want to admin org1 you request /admin/org1. Viewing of org1
> is /view/org1.
> Can you explain why admin the competition 'tmx4' needs to be done with
> such a URI? IMHO there is nothing wrong to view the organisation snc
> and a click on the competition tmx4 requests /view/tmx4.
> Regards,
> Richard
>
> On Fri, Jun 19, 2009 at 12:20 AM, Rob Johnston<[email protected]> wrote:
>   
>> Hi list
>>
>> I've spent some time with google today, investigating using UrlBindings
>> to set up a REST-ish architecture. From the looks of things, Stripes
>> can't handle this out of the box... is this correct?
>>
>> Here's my situation... At a basic level, the application allows a number
>> of organisations (with 'view' and 'admin' events), each of which can
>> have multiple competitions (again with 'view' and 'admin' events). The
>> idea being:
>> - www.site.com/org/snc/view : should invoke the 'view' event of the
>> organisation 'snc'
>> - www.site.com/org/snc/comp/tmx4/admin : should invoke the 'admin' event
>> of the competition 'tmx4', which belongs to the organisation 'snc'
>>
>> My web.xml has this fragment:
>>   <servlet-mapping>
>>       <servlet-name>StripesDispatcher</servlet-name>
>>       <url-pattern>/org/</url-pattern>
>>   </servlet-mapping>
>>
>> And two Action Beans as such:
>>
>> @UrlBinding("/org/{code}/{$event}/")
>> public class OrganisationActionBean extends BaseActionBean {
>>   ...
>> }
>>
>> @UrlBinding("/org/{orgCode}/comp/{compCode}/{$event}")
>> public class CompetitionActionBean extends BaseActionBean {
>>   ...
>> }
>>
>> However, going to the "view organisation" url
>> (www.site.com/org/snc/view) invokes the CompetitionActionBean with
>> 'orgCode' set to 'snc/view'. The most obvious way to get this happening
>> correctly is to have one action bean that just parses the url and
>> decides what to do, but that's not terribly elegant. What's a
>> "stripes-ier" way to go about this?
>>
>> I'm still getting to grips with web development, so any guidance would
>> be greatly appreciated. Cheers
>>
>> ------------------------------------------------------------------------------
>> Crystal Reports - New Free Runtime and 30 Day Trial
>> Check out the new simplified licensing option that enables unlimited
>> royalty-free distribution of the report engine for externally facing
>> server and web deployment.
>> http://p.sf.net/sfu/businessobjects
>> _______________________________________________
>> Stripes-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.5.364 / Virus Database: 270.12.79/2186 - Release Date: 06/18/09 
> 17:59:00
>
>   

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to