wood burning stoves 2.0*
The moose likes Blog around the Campfire and the fly likes why ** is slightly different between Ant and Java 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Blog around the Campfire
Bookmark "why ** is slightly different between Ant and Java 7" Watch "why ** is slightly different between Ant and Java 7" New topic
Author

why ** is slightly different between Ant and Java 7

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30957
    
158

The code and scenario are here

It ends with:
The Ant approach probably feels more natural to me because I’ve been using it longer. But the Java approach seems more logical because it doesn’t have the extra slash that doesn’t actually get matched.


Which approach do you find more natural? I suspect the Java once, but I'd like to see if that reality matches for someone who hasn't used Ant.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1680
    
    7

I like the Ant one, but like you I have used so many frameworks that have adapted the Ant style pattern matching that I am probably just used to it.


[How To Ask Questions][Read before you PM me]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30957
    
158

Bill Gorder wrote:I like the Ant one, but like you I have used so many frameworks that have adapted the Ant style pattern matching that I am probably just used to it.

Interesting. Can you give an example of a framework that uses the Ant style? I wasn't aware it was adopted elsewhere. (it isn't surprising though)
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1680
    
    7

The most notable one is Spring, and of course Spring Security (and Acegi before that). Apache Shiro (another Security framework) also uses ant style pattern/path matching.

http://docs.spring.io/spring-security/site/docs/3.2.0.RELEASE/apidocs/org/springframework/security/web/util/AntPathRequestMatcher.html
http://docs.spring.io/spring/docs/3.1.4.RELEASE/javadoc-api/org/springframework/util/AntPathMatcher.html
http://docs.spring.io/spring/docs/2.5.6/api/org/springframework/core/io/support/PathMatchingResourcePatternResolver.html

To name a few of the classes.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30957
    
158

Of course. I've even used that feature in Spring. I didn't notice the style of ** because I just assumed it always worked that way! Thanks for reminding.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why ** is slightly different between Ant and Java 7