Convention does needs the views to be in the same directory structure
as the namespace of the action. Yes, all the convention code is
committed, a change to struts-plugin.xml in REST would be needed:
Index: C:/src/struts2/plugins/rest/src/main/resources/struts-plugin.xml
===================================================================
--- C:/src/struts2/plugins/rest/src/main/resources/struts-plugin.xml
(revision
652924)
+++ C:/src/struts2/plugins/rest/src/main/resources/struts-plugin.xml (working
copy)
@@ -24,7 +24,7 @@
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
-
+
<struts>
<bean type="com.opensymphony.xwork2.ActionProxyFactory"
name="rest" class="org.apache.struts2.rest.RestActionProxyFactory" />
@@ -29,8 +29,6 @@
<bean type="com.opensymphony.xwork2.ActionProxyFactory"
name="rest" class="org.apache.struts2.rest.RestActionProxyFactory" />
<bean type="org.apache.struts2.dispatcher.mapper.ActionMapper"
name="rest" class="org.apache.struts2.rest.RestActionMapper" />
-
- <bean type="com.opensymphony.xwork2.config.PackageProvider"
name="rest" class="org.apache.struts2.rest.ControllerClasspathPackageProvider"
/>
<bean class="org.apache.struts2.rest.ContentTypeHandlerManager" />
@@ -43,13 +41,16 @@
<constant name="struts.mapper.class" value="rest" />
<constant name="struts.mapper.idParameterName" value="id" />
<constant name="struts.action.extension" value="xhtml,,xml,json" />
-
+ <constant name="struts.convention.action.suffix" value="Controller" />
+ <constant name="struts.convention.action.mapAllMatches" value="true"/>
+ <constant name="struts.convention.action.checkImplementsAction"
value="false"/>
+
<!-- Disable the scanning by the codebehind plugin to prevent
duplicates -->
<constant name="struts.configuration.classpath.disableActionScanning"
value="true" />
-
+
<constant name="struts.configuration.rest.disableControllerScanning"
value="false" />
<constant name="struts.configuration.classpath.defaultParentPackage"
value="rest-default" />
-
+
<package name="rest-default" extends="struts-default">
<result-types>
<result-type name="redirect"
class="org.apache.struts2.dispatcher.ServletRedirectResult">
@@ -108,7 +109,7 @@
<param
name="excludeMethods">input,back,cancel,browse,index,show,edit,editNew</param>
</interceptor-ref>
</interceptor-stack>
-
+
</interceptors>
<default-interceptor-ref name="restDefaultStack"/>
musachy
On Thu, May 22, 2008 at 12:30 AM, dusty <[EMAIL PROTECTED]> wrote:
>
> I have a largish app that I wrote with RESTful design. It doesn't use the
> REST plugin because I didn't like the codebehind results default. Having
> all my views in a flat directory with action-result.ext on a large project
> doesn't work. Instead I organized my views action/results (i.e.
> PatientController : WEB-INF/pages/patient/index.jsp or edit.jsp, etc). Its
> more like Rails and on larger projects its way easier to follow. I am not
> sure if you nest view directories under the parent contollers packages....
>
> So I ended up just wiring it up using XML configuration. Since then, I have
> been playing with the REST and Codebehind plugin. I got the Codebehind
> plugin to organize the view files the way I wanted, but with Convention and
> smart-urls still out there, I was worried about tying an app to one of them.
> Somehow when working with the REST plugin its seems unfinished....
>
> Struts2 definitely needs less options in the configuration and action
> invocation space. The whole idea behind convention over configuration is
> that the software should be opinionated. There should be "a way".
>
> - We need customizable routes where you can embed parameters, to do things
> like nested resources (/users/[:user_id]/comments/[:id])
> - <s:url .../> and <s:form action=... /> should generate RESTful or
> whatever URLs based on the invocation scheme and routes
> - As I mentioned before the default result organization should be
> package-past-baseactionpackage/contoller/result.jsp|ftl
>
> But most importantly we need one way! Convention looks great, I would love
> to see the REST/Convention setup. Did you commit your rest changes?
>
>
>
> Musachy Barroso wrote:
>>
>>> I am trying to figure out what this means! :-) Sounds humorous.
>>
>> yeah, just kidding :)
>>
>> I added a couple of settings to convention so REST can plugin nicely.
>> I have the rest-showcase app working. Does anybody have a bigger REST
>> app to test against?
>>
>> //is svn down?
>>
>> musachy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/-VOTE--Bring-Convention-plugin-into-trunk-and-deprecate-Zero-Config-tp17222798p17397185.html
> Sent from the Struts - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]