public class TinyPathMatcher extends Object
开发人员: renhui
开发时间: 2013-5-15
Constructor and Description |
---|
TinyPathMatcher() |
Modifier and Type | Method and Description |
---|---|
String |
combine(String pattern1,
String pattern2)
Combines two patterns into a new pattern that is returned.
|
public String combine(String pattern1, String pattern2)
This implementation simply concatenates the two patterns, unless the first pattern
contains a file extension match (such as *.html
. In that case, the second pattern
should be included in the first, or an IllegalArgumentException
is thrown.
For example:
Pattern 1 | Pattern 2 | Result |
---|---|---|
/hotels | null | /hotels |
null | /hotels | /hotels |
/hotels | /bookings | /hotels/bookings |
/hotels | bookings | /hotels/bookings |
/hotels/* | /bookings | /hotels/bookings |
/hotels/** | /bookings | /hotels/**/bookings |
/hotels | {hotel} | /hotels/{hotel} |
/hotels/* | {hotel} | /hotels/{hotel} |
/hotels/** | {hotel} | /hotels/**/{hotel} |
/*.html | /hotels.html | /hotels.html |
/*.html | /hotels | /hotels.html |
/*.html | /*.txt | IllegalArgumentException |
pattern1
- the first patternpattern2
- the second patternIllegalArgumentException
- when the two patterns cannot be combinedCopyright © 2006–2018 TinyGroup. All rights reserved.