[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: REST in Struts 2 Web Applications developer researcher Thu Feb 16 10:01:38 2012


     Seems that there is not much documentation, examples or tutorials on
this topic. The only resource I have found on a similar case is in the
following forum:

     This seems a case for
org.apache.struts2.dispatcher.mapper.CompositeActionMapper but neither
there is much information about this class.

     An alternative solutions is use the Spring's support for REST for web
applications that used both frameworks.

     Does anyone have an example or tutorial for this case using only
struts2 and rest plugin?

Thanks and regards,

2012/2/10 developer researcher <[EMAIL PROTECTED]>

>      Hello Lukasz, thank you for your answer,
> *1.* I have severals problems when include the configuration for the
> rest-plugin in struts.xml (attachment the file):
> - Get HTTP for http://ipserver:port/weapp/index.action (for example)
> return HTTP 404 code error. Before include the rest plugin configuration
> the application worked fine.
> - The generated code for <s:a title="Link Index Action"
> action="index.action"> now is <a href="/webapp/index.action.xhtml"
> title="Link Index Action" />. Before include the rest plugin configuration
> the generated code was <a href="/webapp/index.action" title="Link Index
> Action" />. Why is added the suffix '.xhtml' to the URL of the actions?
> This result in the next Exception: *java.lang.NoSuchMethodException:
> com.opensymphony.xwork2.ActionSupport.index()*
> *2.* For the rest's methods (index, show, create, update, destry, edit
> and new) Do the REST Actions must extend from some class or implement some
> interface of the Struts2 API?
>      I hope you can help me understand and use the rest plugin since my
> application is based on struts2 and the ideal, in my case, would be that
> the rest requirements are implemented within the same application and
> because I not found much information about rest plugin.
> Thanks and regards,
> 2012/2/10 Łukasz Lenart <[EMAIL PROTECTED]>
>> 2012/2/9 developer researcher <[EMAIL PROTECTED]>:
>> > 1. both normal action and restful action in the same web application.
>> Define struts.rest.namespace as mentioned in the docs
>> > 2. The URL structure for resources must be:
>> > - /list/ ==> show a list of resoruces in json format
>> > - /list/{id} ==> show the resource identified by id
>> /list/ => implement ListAction.index
>> /list/{id} => implement ListAction.show
>> Regards
>> --
>> Łukasz
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]