Hi Don,

Thanks for the quick updates. The update to xwork seems fine as it supports namespaces like "/animals/*" via the wildcard handling in findActionConfigInNamespace(String namespace, String name).

Unfortunately in the case of the rest plugin, the RestActionMapper first calculates the namespace and action name and isn't yet aware of wildcards. The specific problem is that: parseNameAndNamespce(uri, .....) extracts the namespace and action name from the uri and still assumes the namespace is an exact match with the prefix of the uri. Instead of matching the wildcard namespace it falls back to the default namespace and an invalid action name.

ie. in the case of @Namespace("/animals/*) it determines that the namespace is / and the action name "animals/*"

When the wild-card aware findActionConfigInNamespace() method is called, incorrect namespace and action names are passed as parameters so it fails.

Responsible code:
RestActionMapper.java
290: String ns = ((PackageConfig) i.next()).getNamespace();
291: if (ns != null && prefix.startsWith(ns) && (prefix.length() == ns.length() || prefix.charAt(ns.length()) == '/')) {

--
A separate small issue is that NamedVariablePatterMatcher isn't enabled yet. The XWorkConfigurationProvider enables only the WildercardHelper. However, when I do enable it instead of WildcardHelper it works great. I'm not sure how/if you intended both pattern matchers to be supported at once?

Anyway, I hope that's helpful feedback. I'm eargerly awaiting these updates because I think the new rest plugin is an important advance for struts2. I'd be happy to provide unit tests if it helps.
regards,
Jeromy Evans

Don Brown wrote:
Doh, thanks.  Added.

Don

On 10/28/07, Jeromy Evans <[EMAIL PROTECTED]> wrote:
Hi Don,
I can see your updates to xwork and the rest plugin - look great - but
the new classes NamespaceMatcher and NamespaceMatch used by xwork's
DefaultConfiguration seem to be missing from svn.  Can you please take a
look?

https://svn.opensymphony.com/svn/xwork/trunk/src/java/com/opensymphony/xwork2/config/impl/
R1663

svn info:
https://svn.apache.org/repos/asf/struts/sandbox/trunk/struts2-rest-plugin
Revision: 589249
URL: https://svn.opensymphony.com/svn/xwork/trunk
Revision: 1663
URL: https://svn.apache.org/repos/asf/struts/struts2/trunk
Revision: 589251

Thanks,
 Jeromy Evans

Don Brown wrote:
The code has been checked into XWork, but since the upcoming Struts
2.1.0 release will depend on XWork 2.1.0 and not XWork 2.1.1 (which
trunk will be when it is released next), the feature won't be
available until Struts 2.1.1.

Basically how it works is you define your namespace to be:
@Namespace("/states/{state}"), then define a setState() method on your
controller to get the 'state' value.

Don

On 10/26/07, Jeromy Evans <[EMAIL PROTECTED]> wrote:

Don Brown wrote:

You are correct, #3 isn't possible right now with the rest plugin,
however, it is certainly on the near-term roadmap.  What is needed is
the ability to define wildcards in the namespace, also known as url
templates.  For example, you could do something like
@Namespace("/states/{state}") on your CitiesController class.


Thanks Don. That'll be perfect!  I'll keep an eye on the xwork trunk and
dev list.

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



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





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



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






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

Reply via email to