You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Rank <er...@lo-fi.net> on 2007/01/05 19:24:28 UTC

[S2] how to specify ActionMapper -- Restful2ActionMapper

I'm interested in using the Restful2ActionMapper, but I'm unclear  
about how to specify it's usage.

1. I'm assuming that I'll need to modify the "struts.mapper.class"  
struts property. Is that right?
2. In the struts-default.xml file that ships with Struts2, there's a  
line, which names the class to "restful2":

<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"  
name="restful2"  
class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" />

So, assuming that I need to modify the struts.mapper.class property,  
which is right:

struts.mapper.class=restful2

or

struts.mapper.class=org.apache.struts2.dispatcher.mapper.Restful2ActionM 
apper


3. On a side note, I'm looking for a little clarification on the ReST  
conventions in S2. The ReST conventions specify some fringe HTTP  
methods (DELETE, PUT) for invoking the "remove" and "create" methods  
of an action. To work around the limitations of HTML, the docs say to  
use the parameter "__http_method" in order to make it work.  
Practically speaking, does this mean that I need a form field to do  
this?

<s:hidden name="__http_method" value="'PUT'" />

If I understand correctly, will this form field invoke the "create"  
method of my action?

Thanks!

Eric Rank

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


Re: [S2] how to specify ActionMapper -- Restful2ActionMapper

Posted by Eric Rank <er...@lo-fi.net>.
Thanks Don, that's the clarification I was looking for.

Eric


On Jan 5, 2007, at 2:47 PM, Don Brown wrote:

> On 1/5/07, Eric Rank <er...@lo-fi.net> wrote:
>> I'm interested in using the Restful2ActionMapper, but I'm unclear
>> about how to specify it's usage.
>>
>> 1. I'm assuming that I'll need to modify the "struts.mapper.class"
>> struts property. Is that right?
>
> Yep.
>
>> 2. In the struts-default.xml file that ships with Struts2, there's a
>> line, which names the class to "restful2":
>>
>> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"
>> name="restful2"
>> class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" />
>>
>> So, assuming that I need to modify the struts.mapper.class property,
>> which is right:
>>
>> struts.mapper.class=restful2
>>
>> or
>>
>> struts.mapper.class=org.apache.struts2.dispatcher.mapper.Restful2Acti 
>> onM
>> apper
>
> Either is fine, but I'd recommend the first one.  The second syntax is
> more useful when you have your own class you want to use.
>
>>
>>
>> 3. On a side note, I'm looking for a little clarification on the ReST
>> conventions in S2. The ReST conventions specify some fringe HTTP
>> methods (DELETE, PUT) for invoking the "remove" and "create" methods
>> of an action. To work around the limitations of HTML, the docs say to
>> use the parameter "__http_method" in order to make it work.
>> Practically speaking, does this mean that I need a form field to do
>> this?
>>
>> <s:hidden name="__http_method" value="'PUT'" />
>>
>> If I understand correctly, will this form field invoke the "create"
>> method of my action?
>
> Yes, that's my understanding.  I really like this action mapper, but
> it does need some more thought as to exactly the best way to emulate
> ReST in web applications, and better integration from the tag
> libraries.  The Ruby on Rails community has done some great work in
> this area I think we can learn from.
>
> Don
>>
>> Thanks!
>>
>> Eric Rank
>>
>> ---------------------------------------------------------------------
>> 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: [S2] how to specify ActionMapper -- Restful2ActionMapper

Posted by Don Brown <do...@gmail.com>.
On 1/5/07, Eric Rank <er...@lo-fi.net> wrote:
> I'm interested in using the Restful2ActionMapper, but I'm unclear
> about how to specify it's usage.
>
> 1. I'm assuming that I'll need to modify the "struts.mapper.class"
> struts property. Is that right?

Yep.

> 2. In the struts-default.xml file that ships with Struts2, there's a
> line, which names the class to "restful2":
>
> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"
> name="restful2"
> class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" />
>
> So, assuming that I need to modify the struts.mapper.class property,
> which is right:
>
> struts.mapper.class=restful2
>
> or
>
> struts.mapper.class=org.apache.struts2.dispatcher.mapper.Restful2ActionM
> apper

Either is fine, but I'd recommend the first one.  The second syntax is
more useful when you have your own class you want to use.

>
>
> 3. On a side note, I'm looking for a little clarification on the ReST
> conventions in S2. The ReST conventions specify some fringe HTTP
> methods (DELETE, PUT) for invoking the "remove" and "create" methods
> of an action. To work around the limitations of HTML, the docs say to
> use the parameter "__http_method" in order to make it work.
> Practically speaking, does this mean that I need a form field to do
> this?
>
> <s:hidden name="__http_method" value="'PUT'" />
>
> If I understand correctly, will this form field invoke the "create"
> method of my action?

Yes, that's my understanding.  I really like this action mapper, but
it does need some more thought as to exactly the best way to emulate
ReST in web applications, and better integration from the tag
libraries.  The Ruby on Rails community has done some great work in
this area I think we can learn from.

Don
>
> Thanks!
>
> Eric Rank
>
> ---------------------------------------------------------------------
> 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: [S2] how to specify ActionMapper -- Restful2ActionMapper

Posted by Eric Rank <er...@lo-fi.net>.
Thanks Nate, that's what I needed to know

Eric Rank

On Jan 5, 2007, at 11:44 AM, Nate Drake wrote:

> Eric Rank <ericrank <at> lo-fi.net> writes:
>> 2. In the struts-default.xml file that ships with Struts2, there's a
>> line, which names the class to "restful2":
>>
>> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"
>> name="restful2"
>> class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" />
>>
>> So, assuming that I need to modify the struts.mapper.class property,
>> which is right:
>>
>> struts.mapper.class=restful2
>>
>> or
>>
>> struts.mapper.class=org.apache.struts2.dispatcher.mapper.Restful2Acti 
>> onM
>> apper
>>
>
> You need to use the fully qualified classname.
>
> So this should work:
>
> struts.mapper.class=org.apache.struts2.dispatcher.mapper.Restful2Actio 
> nMapper
>
> Not sure about the answer to question #3.
>
>
>
> ---------------------------------------------------------------------
> 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: [S2] how to specify ActionMapper -- Restful2ActionMapper

Posted by Nate Drake <nd...@gmail.com>.
Eric Rank <ericrank <at> lo-fi.net> writes:
> 2. In the struts-default.xml file that ships with Struts2, there's a  
> line, which names the class to "restful2":
> 
> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"  
> name="restful2"  
> class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" />
> 
> So, assuming that I need to modify the struts.mapper.class property,  
> which is right:
> 
> struts.mapper.class=restful2
> 
> or
> 
> struts.mapper.class=org.apache.struts2.dispatcher.mapper.Restful2ActionM 
> apper
> 

You need to use the fully qualified classname.

So this should work:

struts.mapper.class=org.apache.struts2.dispatcher.mapper.Restful2ActionMapper

Not sure about the answer to question #3.



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