Hi Rick,

Strange, I have two actions bound at :

/api/foo/{p}
/api/foo/{p}/bar/{q}

And I have a conflict.

I have DMF, maybe that's the reason for the problem ? I will try with a
mapped DispatcherServlet.

Thanks

Rémi

2016-03-11 20:21 GMT+01:00 Rick Grashel <[email protected]>:

> Hi Remi,
>
> I use this kind of a scheme by mapping API urls into the StripesDispatcher
> and then using @UrlBinding on API-based ActionBeans.  So the web.xml would
> look like:
>
> <servlet-mapping>
>     <servlet-name>StripesDispatcher</servlet-name>
>     <url-pattern>/api/*</url-pattern>
> </servlet-mapping>
>
> Then, I would have two different action beans.  The class declarations for
> those would look like this:
>
> @UrlBinding( "/api/major" )
> public class MajorActionBean implements ActionBean
>
> @UrlBinding( "/api/major/{someNumber}" )
> public class MajorMinorActionBean implements ActionBean
>
> Now, if I call "http://myapp/api/major";, then "MajorActionBean" will be
> executed.  If I call "http://myapp/api/major/1";, then
> "MajorMinorActionBean" will be executed and the "someNumber" parameter will
> be bound to it.
>
> So Stripes does the correct thing in terms of using a "best-match"
> approach when it comes resolving UrlBindings to ActionBeans.  It actually
> does a pretty good job.  If you keep your API clean and simple, Stripes can
> resolve RESTful bindings extremely well, but if you are not consistent in
> how you design clean URLs, it will not work.  In those situations, you will
> need to write you own resolver.
>
> Hope that helps,
>
> -- Rick
>
>
>
> On Fri, Mar 11, 2016 at 12:44 PM, VANKEISBELCK Remi <[email protected]> wrote:
>
>> Hi,
>>
>> I want to create a REST API with the following endpoints :
>>
>> GET /api/store/{store}
>> GET /api/store/{store}/product/{product}
>>
>> Problem is that those URLs clash, and I get an exception :/
>>
>> Can Stripes support such an URL scheme ?
>>
>> Cheers
>>
>> Rémi
>>
>>
>> ------------------------------------------------------------------------------
>> Transform Data into Opportunity.
>> Accelerate data analysis in your applications with
>> Intel Data Analytics Acceleration Library.
>> Click to learn more.
>> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
>> _______________________________________________
>> Stripes-development mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-development
>>
>>
>
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to