You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Frans Thamura <fl...@meruvian.org> on 2008/01/16 15:58:24 UTC

REST Show case

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?

-- 
Frans Thamura

Re: REST Show case

Posted by Frans Thamura <fl...@meruvian.org>.
On 1/17/08, Jeromy Evans <je...@blueskyminds.com.au> wrote:
>
> Hi Frans,
>
> Were you able to checkout the trunk of Struts 2.1 and build it?



i just look inside, still blank of what REST plugins did for struts2

amazing work, but still blank :)

hahaha

F

Re: REST Show case

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
I don't think this has been mentioned before, apologies if it has been. It can't 
do any harm though.

I keep meaning to post here to encourage anyone who wants REST to work better to 
lobby for HTML 5 features.

For example, <form method=""> should accept HTTP delete, put etc.

See the links below.


Adam


> Hi,
> 
> A [discussion][1] has started on what should be inside HTML 5 for  
> *authors* on the public-html mailing list.
> 
> I encourage Web designers, developers and authors to join the HTML WG  
> to voice your requirements, needs and to help create this document. It  
> is the right time for you to participate.
> 
> [Joining the HTML WG][2] is an easy process.
> 
> 
> See the thread
> [1]: http://lists.w3.org/Archives/Public/public-html/2007Nov/thread.html#msg289
> [2]: http://www.w3.org/2004/01/pp-impl/40318/instructions#nonmember
> 
> 
> --
> Karl Dubost - W3C
> http://www.w3.org/QA/
> Be Strict To Be Cool
> 
> 
> 
> 
> 
> +----------------------------------------------------------------------+
>   more info about webdesign-l: http://webdesign-L.com/
>                to unsubscribe: http://webdesign-L.com/mailman/listinfo/list
>   If you had read the list policies: http://webdesign-L.com/policies/
>  you'd know not to "top post": http://en.wikipedia.org/wiki/Top-posting
>      That means that if this line here is in your reply, you lose.
> 



Jeromy Evans on 18/01/08 10:15, wrote:
> No, all my statements relate to Struts2.1.1.  The RestfulActionMapper in 
> Struts2.0.11 is an entirely different beast
> 
> Due to the dependency on CodeBehind and the major changes affecting that 
> plugin it can't be claimed to be ready for production use at this time.
> 
> There are still a few features missing from the Struts2.1.1 REST plugin 
> that are desirable - primarily handling of unsupported methods and http 
> codes.  eg. if your action doesn't have a 'show' method the result 
> should be a 405 Error code (method not supported) instead of throwing an 
> exception.  Some important changes will come through with the 
> Conventions plugin (eg. that index URLs call an index action).  In 
> addition its currently primarily-focused on CRUD operations and I've 
> encountered some annoyances when trying to implement 
> transformation-style services.  However it's still being actively 
> developed and the more people that us it the more like it'll improve.  
> I'm using it in a system NOT YET RELEASED for production and hopefully 
> I'll contribute some patches to the plugin as I proceed.
> 
> Roberto Nunnari wrote:
>> Thank you Jeromy.
>>
>> I'll look into that and experiment a bit!
>>
>> humm.. just one more question.. is it ready for production use?
>> From your statements I understand that you use them all for
>> production use, but if I look at the struts 2.0.11 distribution
>> there's no rest plugin and on the wiki I see that the rest
>> plugin is only available on 2.1.1..
>>
>> Also, the struts 2.0.11 documentation for RestfulActionMapper
>> it reads: 'RESTful URLs are experimental.'
>>
>> Can you confirm that you're successfully deploying RESTful
>> applications for production use using struts 2.0.11?
>>
>> Best regards.
>>
>> -- 
>> Robi
>>
>>
>> Jeromy Evans wrote:
>>> Hi Roberto,
>>>
>>> The CodeBehind plugin is probably being replaced with the 
>>> "Convention" plugin in Struts2.1.1 - a merge of SmartURLs, CodeBehind 
>>> and Zero-Configuration into one plugin. The purpose is that by 
>>> following some conventions almost all the configuration can be 
>>> eliminated.  The intention is to make it easy to migrate from 
>>> CodeBehind.
>>> In the case of Tiles2, yes, the plugin includes a @Result annotation 
>>> that can be included on each action class.  The annotation is 
>>> equivalent to the result in struts.xml (sets the name, the type and 
>>> the parameters).  In the Tiles2 result case you just need to state 
>>> that, for example, for result "index" the result is a tile .  I was 
>>> thinking only last night it a "tiles naming convention" may 
>>> eventually be useful for me too. Of course, your html results, 
>>> whether JSP, FTL, VM, can also all use Tiles2 tags if you want to 
>>> minimize use of the @Result annotation (eg: use 
>>> tiles:insertDefinition within orders-index.jsp).  I use both SiteMesh 
>>> and Tiles2 (together) with the Rest plugin to nice effect.
>>>
>>> You'll find CodeBehind, SmartURLs and ZeroConfiguration information 
>>> on the Struts2 wiki.
>>>
>>> regards,
>>>  Jeromy Evans
>>>
>>> Roberto Nunnari wrote:
>>>> Hi Jeromy.
>>>>
>>>> That's very cool!
>>>>
>>>> One question comes to my mind.
>>>> As I have no idea what the CodeBehind plugin is, and as
>>>> I usully use the tiles plugin, is it possible/easy/hard
>>>> to use REST-CodeBehind-Tiles2 together?
>>>>
>>>> Thanks!
>>>>
>>>> -- 
>>>> Robi
>>>>
>>>>
>>>> Jeromy Evans wrote:
>>>>> 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: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: REST Show case

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
No, all my statements relate to Struts2.1.1.  The RestfulActionMapper in 
Struts2.0.11 is an entirely different beast

Due to the dependency on CodeBehind and the major changes affecting that 
plugin it can't be claimed to be ready for production use at this time.

There are still a few features missing from the Struts2.1.1 REST plugin 
that are desirable - primarily handling of unsupported methods and http 
codes.  eg. if your action doesn't have a 'show' method the result 
should be a 405 Error code (method not supported) instead of throwing an 
exception.  Some important changes will come through with the 
Conventions plugin (eg. that index URLs call an index action).  In 
addition its currently primarily-focused on CRUD operations and I've 
encountered some annoyances when trying to implement 
transformation-style services.  However it's still being actively 
developed and the more people that us it the more like it'll improve.  
I'm using it in a system NOT YET RELEASED for production and hopefully 
I'll contribute some patches to the plugin as I proceed.

Roberto Nunnari wrote:
> Thank you Jeromy.
>
> I'll look into that and experiment a bit!
>
> humm.. just one more question.. is it ready for production use?
> From your statements I understand that you use them all for
> production use, but if I look at the struts 2.0.11 distribution
> there's no rest plugin and on the wiki I see that the rest
> plugin is only available on 2.1.1..
>
> Also, the struts 2.0.11 documentation for RestfulActionMapper
> it reads: 'RESTful URLs are experimental.'
>
> Can you confirm that you're successfully deploying RESTful
> applications for production use using struts 2.0.11?
>
> Best regards.
>
> -- 
> Robi
>
>
> Jeromy Evans wrote:
>> Hi Roberto,
>>
>> The CodeBehind plugin is probably being replaced with the 
>> "Convention" plugin in Struts2.1.1 - a merge of SmartURLs, CodeBehind 
>> and Zero-Configuration into one plugin. The purpose is that by 
>> following some conventions almost all the configuration can be 
>> eliminated.  The intention is to make it easy to migrate from 
>> CodeBehind.
>> In the case of Tiles2, yes, the plugin includes a @Result annotation 
>> that can be included on each action class.  The annotation is 
>> equivalent to the result in struts.xml (sets the name, the type and 
>> the parameters).  In the Tiles2 result case you just need to state 
>> that, for example, for result "index" the result is a tile .  I was 
>> thinking only last night it a "tiles naming convention" may 
>> eventually be useful for me too. Of course, your html results, 
>> whether JSP, FTL, VM, can also all use Tiles2 tags if you want to 
>> minimize use of the @Result annotation (eg: use 
>> tiles:insertDefinition within orders-index.jsp).  I use both SiteMesh 
>> and Tiles2 (together) with the Rest plugin to nice effect.
>>
>> You'll find CodeBehind, SmartURLs and ZeroConfiguration information 
>> on the Struts2 wiki.
>>
>> regards,
>>  Jeromy Evans
>>
>> Roberto Nunnari wrote:
>>> Hi Jeromy.
>>>
>>> That's very cool!
>>>
>>> One question comes to my mind.
>>> As I have no idea what the CodeBehind plugin is, and as
>>> I usully use the tiles plugin, is it possible/easy/hard
>>> to use REST-CodeBehind-Tiles2 together?
>>>
>>> Thanks!
>>>
>>> -- 
>>> Robi
>>>
>>>
>>> Jeromy Evans wrote:
>>>> 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: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: REST Show case

Posted by Roberto Nunnari <ro...@supsi.ch>.
Thank you Jeromy.

I'll look into that and experiment a bit!

humm.. just one more question.. is it ready for production use?
 From your statements I understand that you use them all for
production use, but if I look at the struts 2.0.11 distribution
there's no rest plugin and on the wiki I see that the rest
plugin is only available on 2.1.1..

Also, the struts 2.0.11 documentation for RestfulActionMapper
it reads: 'RESTful URLs are experimental.'

Can you confirm that you're successfully deploying RESTful
applications for production use using struts 2.0.11?

Best regards.

--
Robi


Jeromy Evans wrote:
> Hi Roberto,
> 
> The CodeBehind plugin is probably being replaced with the "Convention" 
> plugin in Struts2.1.1 - a merge of SmartURLs, CodeBehind and 
> Zero-Configuration into one plugin. The purpose is that by following 
> some conventions almost all the configuration can be eliminated.  The 
> intention is to make it easy to migrate from CodeBehind.
> In the case of Tiles2, yes, the plugin includes a @Result annotation 
> that can be included on each action class.  The annotation is equivalent 
> to the result in struts.xml (sets the name, the type and the 
> parameters).  In the Tiles2 result case you just need to state that, for 
> example, for result "index" the result is a tile .  I was thinking only 
> last night it a "tiles naming convention" may eventually be useful for 
> me too. Of course, your html results, whether JSP, FTL, VM, can also all 
> use Tiles2 tags if you want to minimize use of the @Result annotation 
> (eg: use tiles:insertDefinition within orders-index.jsp).  I use both 
> SiteMesh and Tiles2 (together) with the Rest plugin to nice effect.
> 
> You'll find CodeBehind, SmartURLs and ZeroConfiguration information on 
> the Struts2 wiki.
> 
> regards,
>  Jeromy Evans
> 
> Roberto Nunnari wrote:
>> Hi Jeromy.
>>
>> That's very cool!
>>
>> One question comes to my mind.
>> As I have no idea what the CodeBehind plugin is, and as
>> I usully use the tiles plugin, is it possible/easy/hard
>> to use REST-CodeBehind-Tiles2 together?
>>
>> Thanks!
>>
>> -- 
>> Robi
>>
>>
>> Jeromy Evans wrote:
>>> 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: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: REST Show case

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Hi Roberto,

The CodeBehind plugin is probably being replaced with the "Convention" 
plugin in Struts2.1.1 - a merge of SmartURLs, CodeBehind and 
Zero-Configuration into one plugin. The purpose is that by following 
some conventions almost all the configuration can be eliminated.  The 
intention is to make it easy to migrate from CodeBehind. 

In the case of Tiles2, yes, the plugin includes a @Result annotation 
that can be included on each action class.  The annotation is equivalent 
to the result in struts.xml (sets the name, the type and the 
parameters).  In the Tiles2 result case you just need to state that, for 
example, for result "index" the result is a tile .  I was thinking only 
last night it a "tiles naming convention" may eventually be useful for 
me too. Of course, your html results, whether JSP, FTL, VM, can also all 
use Tiles2 tags if you want to minimize use of the @Result annotation 
(eg: use tiles:insertDefinition within orders-index.jsp).  I use both 
SiteMesh and Tiles2 (together) with the Rest plugin to nice effect.

You'll find CodeBehind, SmartURLs and ZeroConfiguration information on 
the Struts2 wiki.

regards,
  Jeromy Evans

Roberto Nunnari wrote:
> Hi Jeromy.
>
> That's very cool!
>
> One question comes to my mind.
> As I have no idea what the CodeBehind plugin is, and as
> I usully use the tiles plugin, is it possible/easy/hard
> to use REST-CodeBehind-Tiles2 together?
>
> Thanks!
>
> -- 
> Robi
>
>
> Jeromy Evans wrote:
>> 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: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: REST Show case

Posted by Roberto Nunnari <ro...@supsi.ch>.
Hi Jeromy.

That's very cool!

One question comes to my mind.
As I have no idea what the CodeBehind plugin is, and as
I usully use the tiles plugin, is it possible/easy/hard
to use REST-CodeBehind-Tiles2 together?

Thanks!

--
Robi


Jeromy Evans wrote:
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: REST Show case

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org