Re: Help : Disable Strict Method Invocation for struts 2 rest plugin
2018-04-29 11:24 GMT+02:00 Yasser Zamani : > I couldn't understand what's the user expected behavior and what we > should try to fix. Because of security, SMI is enabled by default and > user has to annotate or define allowed methods. right? I think there are > no other solution to keep both security and all methods allowed. The problem is that we should support existing configurations (like automatically define allowed methods for those used in struts.xml). The same should happen with the REST plugin but the problem is that i tries to guess the method name based on url. I do not see a good solution for now. Regards -- Ćukasz + 48 606 323 122 http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Support for sub-resources in struts 2 rest plugin
Thanks for your reply. I am already using struts-2 rest plugin in production. What we are trying to solve here, is a hierarchical resource entity API implementation. Let me give an example of what I am trying to do. For getting an organization info, we can use a REST API like /organizations/organization_id, whereas, to get an employee of an organization we need to map it as a sub-resource like /organizations/organization_id/employees/employee_id rather than just making it as /employees/employee_id. Thanks & Regards, Deva. -- Sent from: http://struts.1045723.n5.nabble.com/Struts-User-f3426046.html - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Help : Disable Strict Method Invocation for struts 2 rest plugin
Hi Yasser, We already have a layer of security(a filter which runs first in our web-app) which handles allowed url patterns. So in this we have to again add code for allowed methods. So we are trying to get an option to disable it. Thanks, Deva. -- Sent from: http://struts.1045723.n5.nabble.com/Struts-User-f3426046.html - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Help : Disable Strict Method Invocation for struts 2 rest plugin
On 4/26/2018 4:03 PM, Lukasz Lenart wrote: > Thinking on solution ... not so easy :( I couldn't understand what's the user expected behavior and what we should try to fix. Because of security, SMI is enabled by default and user has to annotate or define allowed methods. right? I think there are no other solution to keep both security and all methods allowed. Regards.
Re: Support for sub-resources in struts 2 rest plugin
On 4/27/2018 11:45 AM, DevaGerald wrote: > Hi, > > Sorry if i miss something here. As of my knowledge, the struts 2 rest plugin > supports only the following : > /resource - GET > /resource - POST > /resource/$resource_id - GET > /resource/$resource_id - PUT > /resource/$resource_id - DELETE > > and also the custom methods like > /resource/$resource_id/my_custom_method - This will land me to the > respective custom method. > > I need to write the following API pattern. > > /resource/$resource_id/sub_resource/$sub_resource_id > > Is this be supported? Plz help me with this. > As far as I see at [1], only the last slash location makes sense, so, it seems no, this isn't supported. However, in Struts REST plugin it seems resources are actions e.g. "DELETE /resource/$resource_id" calls method "setId" of the action "resource" with value "$resource_id" and then calls method "destroy". It's up to you what do you write inside "destroy" method. So, according to above paragraph, could you please describe what are you trying to achieve with e.g. "DELETE /resource/$resource_id/sub_resource/$sub_resource_id"? Because in Struts REST plugin, "resource" and "sub_resource" will be evaluated as two actions, not two master/child database records. Regards. [1] https://github.com/apache/struts/blob/5ebd716fb7ffe10c6f1857c993285c63ab57f838/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java#L340