You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by stanlick <st...@gmail.com> on 2008/06/17 20:46:39 UTC
RestActionMapper
How does this action mapper make its way into the runtime configuration? I
have studied its (and the codebehind) struts-plugin.xml files, but I do not
see where
### How request URLs are mapped to and from actions
#struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
Is being overriden!
Scott
--
View this message in context: http://www.nabble.com/RestActionMapper-tp17932711p17932711.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: RestActionMapper
Posted by stanlick <st...@gmail.com>.
Also, what are the alternate ReST mappers here?
RestfulActionMapper
RestActionMapper
Restful2ActionMapper
I always get nervous when I see a "2" in a class name.:-((
stanlick wrote:
>
> How does this action mapper make its way into the runtime configuration?
> I have studied its (and the codebehind) struts-plugin.xml files, but I do
> not see where
>
> ### How request URLs are mapped to and from actions
> #struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
>
> Is being overriden!
>
> Scott
>
--
View this message in context: http://www.nabble.com/RestActionMapper-tp17932711p17934214.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: RestActionMapper
Posted by Wes Wannemacher <we...@wantii.com>.
Scott,
The CodebehindUnknownHandler sort of does the work of the action mapper.
Think of it this way, instead of throwing a 404, the request is handled
by CodebehindUnknownHandler which will find the action/result using it's
own semantics. This allows regular struts.xml configuration at the same
time as Codebehind conventions.
-Wes
On Tue, 2008-06-17 at 14:08 -0700, stanlick wrote:
> That's what I expected to find but instead found this:
>
> <struts>
> <bean type="com.opensymphony.xwork2.UnknownHandler"
> class="org.apache.struts2.codebehind.CodebehindUnknownHandler" />
> <bean type="com.opensymphony.xwork2.config.PackageProvider"
> name="codebehind" class="org.apache.struts2.config.ClasspathPackageProvider"
> />
>
> <constant name="struts.codebehind.pathPrefix" value="/"/>
> <constant name="struts.codebehind.defaultPackage"
> value="codebehind-default"/>
> <constant name="struts.mapper.alwaysSelectFullNamespace" value="true" />
>
> <package name="codebehind-default" extends="struts-default">
> </package>
> </struts>
>
> Are you looking at the source in
> /struts-2.1.2/src/plugins/rest/src/main/java?
>
>
>
>
> newton.dave wrote:
> >
> > --- On Tue, 6/17/08, stanlick <st...@gmail.com> wrote:
> >> How does this action mapper make its way into the runtime configuration?
> >
> > In the plugin XML file via bean and constant configs:
> >
> > <bean name="rest"
> > type="org.apache.struts2.dispatcher.mapper.ActionMapper"
> > class="org.apache.struts2.rest.RestActionMapper" />
> >
> > and
> >
> > <constant name="struts.mapper.class" value="rest" />
> >
> > Dave
> >
> >
> > ---------------------------------------------------------------------
> > 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: RestActionMapper
Posted by st...@gmail.com.
Hey Dave --
I understand your confusion now! My home machine 2.1.2 is not the same as
my work machine 2.1.2 (don't ask) I have the jar open and now see what I
expected to find originally! Let me look at *this* a bit and ask the
questions I had to begin with... maybe.
P.S. sitting on the back porch with a Bud Light Lime and the lightning bugs
are reminding me of my childhood.
Scott
On Wed, Jun 18, 2008 at 2:26 PM, Dave Newton <ne...@yahoo.com> wrote:
> --- On Wed, 6/18/08, stanlick <st...@gmail.com> wrote:
> > I am looking in the
> > /struts-2.1.2/src/plugins/rest/src/main/java
> > struts-2.1.2-all.zip.
>
> I don't understand; there's no XML in the Java directories of the download
> (this is from -all):
>
> /tmp/struts-2.1.2/src/plugins/rest $ find . -name "*.xml"
> ./pom.xml
> ./src/main/resources/struts-plugin.xml
>
> And that plugin contains the elements I posted previously:
>
> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="rest"
> class="org.apache.struts2.rest.RestActionMapper" />
> ...
> <constant name="struts.mapper.class" value="rest" />
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Scott
stanlick@gmail.com
Re: RestActionMapper
Posted by Dave Newton <ne...@yahoo.com>.
--- On Wed, 6/18/08, stanlick <st...@gmail.com> wrote:
> I am looking in the
> /struts-2.1.2/src/plugins/rest/src/main/java
> struts-2.1.2-all.zip.
I don't understand; there's no XML in the Java directories of the download (this is from -all):
/tmp/struts-2.1.2/src/plugins/rest $ find . -name "*.xml"
./pom.xml
./src/main/resources/struts-plugin.xml
And that plugin contains the elements I posted previously:
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="rest" class="org.apache.struts2.rest.RestActionMapper" />
...
<constant name="struts.mapper.class" value="rest" />
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: RestActionMapper
Posted by stanlick <st...@gmail.com>.
I am looking in the /struts-2.1.2/src/plugins/rest/src/main/java
struts-2.1.2-all.zip. It sounds like Wes has revealed how this works, which
would explain the struts-plugin.xml I am seeing. If this is correct, it
sure sounds like a crazy way to implement a custom "mapper!" Also, why the
variety of "REST" mapper classes in the distribution?
newton.dave wrote:
>
> --- On Tue, 6/17/08, stanlick <st...@gmail.com> wrote:
>> Are you looking at the source in
>> /struts-2.1.2/src/plugins/rest/src/main/java?
>
> No, I had been looking in trunk.
>
> S2.1.2, however, doesn't differ from trunk w.r.t. the action mapper (see
> appended diff). The config file wouldn't be in the Java directory, either;
> config files are in the resource directory--not sure what you're looking
> at.
>
> Dave
>
> -- Diff of S2.1.2 v. trunk REST plugin config file
>
> ~/s2/svn $ diff -w trunk/plugins/rest/src/main/resources/struts-plugin.xml
> STRUTS_2_1_2/plugins/rest/src/main/resources/struts-plugin.xml
> 4c4
> < * $Id: struts-plugin.xml 663605 2008-06-05 13:31:01Z musachy $
> ---
>> * $Id: struts-plugin.xml 651946 2008-04-27 13:41:38Z apetrelli $
> 32a33,34
>> <bean type="com.opensymphony.xwork2.config.PackageProvider"
>> name="rest"
>> class="org.apache.struts2.rest.ControllerClasspathPackageProvider" />
>>
> 45,48c47,48
> < <!-- Overwrite Codebehind -->
> < <constant name="struts.codebehind.classSuffix" value="Controller"/>
> < <constant name="struts.codebehind.action.checkImplementsAction"
> value="false"/>
> < <constant name="struts.codebehind.action.checkAnnotation"
> value="false"/>
> ---
>> <!-- Disable the scanning by the codebehind plugin to prevent
>> duplicates -->
>> <constant name="struts.configuration.classpath.disableActionScanning"
>> value="true" />
> 49a50
>> <constant name="struts.configuration.rest.disableControllerScanning"
>> value="false" />
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/RestActionMapper-tp17932711p17988764.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: RestActionMapper
Posted by Dave Newton <ne...@yahoo.com>.
--- On Tue, 6/17/08, stanlick <st...@gmail.com> wrote:
> Are you looking at the source in
> /struts-2.1.2/src/plugins/rest/src/main/java?
No, I had been looking in trunk.
S2.1.2, however, doesn't differ from trunk w.r.t. the action mapper (see appended diff). The config file wouldn't be in the Java directory, either; config files are in the resource directory--not sure what you're looking at.
Dave
-- Diff of S2.1.2 v. trunk REST plugin config file
~/s2/svn $ diff -w trunk/plugins/rest/src/main/resources/struts-plugin.xml STRUTS_2_1_2/plugins/rest/src/main/resources/struts-plugin.xml
4c4
< * $Id: struts-plugin.xml 663605 2008-06-05 13:31:01Z musachy $
---
> * $Id: struts-plugin.xml 651946 2008-04-27 13:41:38Z apetrelli $
32a33,34
> <bean type="com.opensymphony.xwork2.config.PackageProvider" name="rest" class="org.apache.struts2.rest.ControllerClasspathPackageProvider" />
>
45,48c47,48
< <!-- Overwrite Codebehind -->
< <constant name="struts.codebehind.classSuffix" value="Controller"/>
< <constant name="struts.codebehind.action.checkImplementsAction" value="false"/>
< <constant name="struts.codebehind.action.checkAnnotation" value="false"/>
---
> <!-- Disable the scanning by the codebehind plugin to prevent duplicates -->
> <constant name="struts.configuration.classpath.disableActionScanning" value="true" />
49a50
> <constant name="struts.configuration.rest.disableControllerScanning" value="false" />
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: RestActionMapper
Posted by stanlick <st...@gmail.com>.
That's what I expected to find but instead found this:
<struts>
<bean type="com.opensymphony.xwork2.UnknownHandler"
class="org.apache.struts2.codebehind.CodebehindUnknownHandler" />
<bean type="com.opensymphony.xwork2.config.PackageProvider"
name="codebehind" class="org.apache.struts2.config.ClasspathPackageProvider"
/>
<constant name="struts.codebehind.pathPrefix" value="/"/>
<constant name="struts.codebehind.defaultPackage"
value="codebehind-default"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="true" />
<package name="codebehind-default" extends="struts-default">
</package>
</struts>
Are you looking at the source in
/struts-2.1.2/src/plugins/rest/src/main/java?
newton.dave wrote:
>
> --- On Tue, 6/17/08, stanlick <st...@gmail.com> wrote:
>> How does this action mapper make its way into the runtime configuration?
>
> In the plugin XML file via bean and constant configs:
>
> <bean name="rest"
> type="org.apache.struts2.dispatcher.mapper.ActionMapper"
> class="org.apache.struts2.rest.RestActionMapper" />
>
> and
>
> <constant name="struts.mapper.class" value="rest" />
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/RestActionMapper-tp17932711p17937586.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: RestActionMapper
Posted by Dave Newton <ne...@yahoo.com>.
--- On Tue, 6/17/08, stanlick <st...@gmail.com> wrote:
> How does this action mapper make its way into the runtime configuration?
In the plugin XML file via bean and constant configs:
<bean name="rest"
type="org.apache.struts2.dispatcher.mapper.ActionMapper"
class="org.apache.struts2.rest.RestActionMapper" />
and
<constant name="struts.mapper.class" value="rest" />
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org