Hi Frans,

Were you able to checkout the trunk of Struts 2.1 and build it?

If you got that far, then you have a copy of the full rest show-case in the apps directory. Yes, there are surprisingly few settings as the showcase uses the CodeBehind plugin so there's no struts.xml or other essential configuration files.

As a quick run-down of the how the application works:
- the rest plugin is included via the pom.xml. All the other dependencies except junit are transitive. - web.xml enables the struts filter and init-params specify where the actions can be found (and enables dev mode) - There's one action, OrdersController, a mock service (OrdersService) and a business object (Order). The REST actions are called Controllers following the RubyOnRails conventions.
 - The default index.jsp file will simple redirect to GET /orders
- When you GET /orders/, the index () method is executed in the OrdersController action. It loads the list of orders and returns the "index" result. - CodeBehind maps the index result to orders-index.jsp and the html result is rendered. - If you GET /orders/1, the show() method is executed in the OrdersController action. It loads the order with that id and returns the "show" result. Again, the CodeBehind plugin maps this to orders-show.jsp based on the convention. - So on for post, new, delete, put etc operations - they call a method and render a default result.

In addition:
- When you get /orders/1.json, the ContentTypeHandler will serialise the model as JSON instead of executing a view result - When you get /orders/1.xml, the ContentTypeHandler will serialise the model as XML instead of executing a view result.
You can view both of these in the browser.

That's basically it. There's minimal configuration required because it's a convention-based application.

I hope that helps.  Build it and experiment!

regards,
Jeromy Evans

Frans Thamura wrote:
hi all

i just see the rest-showcase. this is amazing approach

but i only see the example class , and no setting about this

anyone can give me the glue about this ?

still lost about how the REST in struts 2.1.11, how does it wor?

------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.19.2/1224 - Release Date: 14/01/2008 5:39 PM


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to