struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Using Struts2 Rest Plugin with deep cascading actions
Date Sat, 24 Jan 2015 23:38:43 GMT



> Date: Sat, 24 Jan 2015 15:24:49 +0530
> Subject: Re: Using Struts2 Rest Plugin with deep cascading actions
> From: ghotankarua50@gmail.com
> To: user@struts.apache.org
> 
> Well after doing some research on designing rest api ***best practices*** I
> realized I was doing something wrong.
> 
> For getting all companies, we must use
> 
> http://localhost/company
> 
> For getting all locations of that company we can use
> 
> http://localhost/company/111/locations
> 
> For anything else to get from any particular location we can use
> 
> http://localhost/company/locations/111 - to get location details
> ****(/company/ only in namespacing )
> 
> http://localhost/company/locations/111/contacts - to get location contacts
> 
> etc.............
> 
> 
> Now question is how do we implement namespacing in struts2 rest api???
> 
> As by default all actions are @root right?
> 
> can we have @namespace(value="/company/") annotation in Location Action????
> 
> But this does not work for me, it redirects to company action only and says
> no method available.
> 
> Or we must not use such namespacing and its better to use
> http://localhost/location instead of http://localhost/company/location
> 
> Please suggest. 

MG>you need to specify the namespace attribute in <package specification
MG>http://www.mkyong.com/struts2/struts-2-namespace-configuration-example-and-explanation
MG>there is a movement to add more "annotation based specifications" at ActionClass level
in the new Struts 3.x
MG>if you make a request in Struts JIRA and add a testcase then one of or more of us will
follow thru if this feasible
MG>https://issues.apache.org/jira/secure/Dashboard.jspa

> 
> On Fri, Jan 23, 2015 at 4:20 PM, Amol Ghotankar <ghotankarua50@gmail.com>
> wrote:
> 
> > hi,
> >
> > I was trying out struts2 rest plugin and found it really cool.
> >
> > But was just wondering how will this work with action cascading ? i.e
> >
> > So When using http://localhost/company it goes to companyAction and
> > executes respective mapped methods
> >
> > But how do we organize work when we
> > http://localhost/company/1/locations/2/contact/2/ ???
> >
> > Will these be methods in same class? Class will grow too big & if not how
> > does it get mapped to contactAction and pass values their?
> >
> > How about more complex case where we have
> > http://localhost/company/1/locations/2/contact/2/order/2/transaction/1/payment
> > or something like this???
> >
> > Domain objects are hibernate entities when company has locations has
> > contacts has orders has transaction has payments?
> >
> > or should the rest url be something different and simplified? like
> > http://localhost/order/2/transaction/1/payment but still has issues
> > mapping things and reusing actions?
> >
> > Am I missing something in rest plugin?
> >
> > --
> >
> >
> >
> > *With Best Regards,*
> >
> > Amol Ghotankar
> > Technical Lead
> > M: +91 9960 980 419 <http://www.cursivetech.com>
> >
> 
> 
> 
> -- 
> 
> 
> 
> *With Best Regards,*
> 
> Amol Ghotankar
> Technical Lead
> M: +91 9960 980 419 <http://www.cursivetech.com>
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message