@@ -176,16 +176,15 @@ public MatchedResource<E> getMatched(String path)
176
176
int i = path .length ();
177
177
while (i >= 0 )
178
178
{
179
- MappedResource <E > candidate = _exactMap .getBest (path , 0 , i );
179
+ MappedResource <E > candidate = _exactMap .getBest (path , 0 , i -- );
180
180
if (candidate == null )
181
- break ;
181
+ continue ;
182
182
183
183
matchedPath = candidate .getPathSpec ().matched (path );
184
184
if (matchedPath != null )
185
185
{
186
186
return new MatchedResource <>(candidate .getResource (), candidate .getPathSpec (), matchedPath );
187
187
}
188
- i --;
189
188
}
190
189
// If we reached here, there's NO optimized EXACT Match possible, skip simple match below
191
190
skipRestOfGroup = true ;
@@ -200,14 +199,13 @@ public MatchedResource<E> getMatched(String path)
200
199
int i = path .length ();
201
200
while (i >= 0 )
202
201
{
203
- MappedResource <E > candidate = _prefixMap .getBest (path , 0 , i );
202
+ MappedResource <E > candidate = _prefixMap .getBest (path , 0 , i -- );
204
203
if (candidate == null )
205
- break ;
204
+ continue ;
206
205
207
206
matchedPath = candidate .getPathSpec ().matched (path );
208
207
if (matchedPath != null )
209
208
return new MatchedResource <>(candidate .getResource (), candidate .getPathSpec (), matchedPath );
210
- i --;
211
209
}
212
210
// If we reached here, there's NO optimized PREFIX Match possible, skip simple match below
213
211
skipRestOfGroup = true ;
@@ -220,11 +218,16 @@ public MatchedResource<E> getMatched(String path)
220
218
if (_optimizedSuffix )
221
219
{
222
220
int i = 0 ;
221
+ // Loop through each suffix mark
222
+ // Input is "/a.b.c.foo"
223
+ // Loop 1: "b.c.foo"
224
+ // Loop 2: "c.foo"
225
+ // Loop 3: "foo"
223
226
while ((i = path .indexOf ('.' , i + 1 )) > 0 )
224
227
{
225
228
MappedResource <E > candidate = _suffixMap .get (path , i + 1 , path .length () - i - 1 );
226
229
if (candidate == null )
227
- break ;
230
+ continue ;
228
231
229
232
matchedPath = candidate .getPathSpec ().matched (path );
230
233
if (matchedPath != null )
0 commit comments