KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > util > PathMatcher


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.util;
18
19 /**
20  * Strategy interface for <code>String</code>-based path matching.
21  *
22  * <p>Used by {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver},
23  * {@link org.springframework.web.servlet.handler.AbstractUrlHandlerMapping},
24  * {@link org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver},
25  * and {@link org.springframework.web.servlet.mvc.WebContentInterceptor}.
26  *
27  * <p>The default implementation is {@link AntPathMatcher}, supporting the
28  * Ant-style pattern syntax.
29  *
30  * @author Juergen Hoeller
31  * @since 1.2
32  * @see AntPathMatcher
33  */

34 public interface PathMatcher {
35
36     /**
37      * Does the given <code>string</code> represent a pattern that can be matched
38      * by an implementation of this interface?
39      * <p>If the return value is <code>false</code>, then the {@link #match}
40      * method does not have to be used because direct equality comparisons will
41      * be sufficient.
42      * @param text the <code>string</code> to check
43      * @return <code>true</code> if the given <code>string</code> represents a pattern
44      */

45     boolean isPattern(String JavaDoc text);
46
47     /**
48      * Match the given <code>text</code> against the given <code>pattern</code>.
49      * @param pattern the pattern to match against
50      * @param text the string to test
51      * @return <code>true</code> if the supplied <code>text</code> matched
52      */

53     boolean match(String JavaDoc pattern, String JavaDoc text);
54
55     /**
56      * Given a pattern and a full path, returns the non-pattern mapped part.
57      * @param pattern the path pattern
58      * @param path the full path
59      * @return the non-pattern mapped part of the given <code>path</code>
60      */

61     String JavaDoc extractPathWithinPattern(String JavaDoc pattern, String JavaDoc path);
62 }
63
Popular Tags