abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Ancona <...@anconafamily.com>
Subject Re: unit testing RegexTargetResolver
Date Tue, 09 Oct 2007 21:12:03 GMT
Chris Berry wrote:
> (RegExs are notoriously hard to get right, particularly when there are a 
> multitude of use cases  ;-)

I wonder if regular expressions are too powerful for this application. 
Perhaps something like  Ant paths, as used in Spring's 
SimpleUrlHandlerMapping[1] would better hit the 80/20 point?

So the example from the RegexTargetResolver javadocs would change from

tr.setPattern("/atom/([^/#?]+)/([^/#?]+)",ResourceType.ENTRY);

to

tr.setPattern("/atom/*/*",ResourceType.ENTRY);

If this sounds worthwhile, I could try putting an AntPathTargetResolver 
together.

A related question: Does Abdera provide any support for getting the 
pattern matches from the Target? (I couldn't find any.) I ran into a 
Spring extension called ParameterizedUrlHandlerMapping[2] which 
addresses a similar problem by naming the patterns so they can be 
accessed downstream.

Jim

[1] - 
http://www.springframework.org/docs/api/org/springframework/web/servlet/handler/SimpleUrlHandlerMapping.html
[2] - 
http://www.carbonfive.com/community/archives/2007/06/parameterized_rest_urls_with_spring_mvc.html

Mime
View raw message