winstone
Class Mapping
java.lang.Object
winstone.Mapping
- All Implemented Interfaces:
- java.util.Comparator
public class Mapping
- extends java.lang.Object
- implements java.util.Comparator
Encapsulates the parsing of URL patterns, as well as the mapping of a
url pattern to a servlet instance
- Version:
- $Id: Mapping.java,v 1.9 2007/04/23 02:55:35 rickknowles Exp $
- Author:
- Rick Knowles
Constructor Summary |
protected |
Mapping(java.lang.String mappedTo)
|
Method Summary |
int |
compare(java.lang.Object objOne,
java.lang.Object objTwo)
Used to compare two url patterns. |
static Mapping |
createFromLink(java.lang.String mappedTo,
java.lang.String linkName)
Factory constructor method - this turns a servlet name into a mapping element |
static Mapping |
createFromURL(java.lang.String mappedTo,
java.lang.String pattern)
Factory constructor method - this parses the url pattern into pieces we can use to match
against incoming URLs. |
java.lang.String |
getLinkName()
|
java.lang.String |
getMappedTo()
|
int |
getPatternType()
|
java.lang.String |
getUrlPattern()
|
boolean |
match(java.lang.String inputPattern,
java.lang.StringBuffer servletPath,
java.lang.StringBuffer pathInfo)
Try to match this pattern against the incoming url |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
EXACT_PATTERN
public static final int EXACT_PATTERN
- See Also:
- Constant Field Values
FOLDER_PATTERN
public static final int FOLDER_PATTERN
- See Also:
- Constant Field Values
EXTENSION_PATTERN
public static final int EXTENSION_PATTERN
- See Also:
- Constant Field Values
DEFAULT_SERVLET
public static final int DEFAULT_SERVLET
- See Also:
- Constant Field Values
STAR
public static final java.lang.String STAR
- See Also:
- Constant Field Values
SLASH
public static final java.lang.String SLASH
- See Also:
- Constant Field Values
Mapping
protected Mapping(java.lang.String mappedTo)
createFromURL
public static Mapping createFromURL(java.lang.String mappedTo,
java.lang.String pattern)
- Factory constructor method - this parses the url pattern into pieces we can use to match
against incoming URLs.
createFromLink
public static Mapping createFromLink(java.lang.String mappedTo,
java.lang.String linkName)
- Factory constructor method - this turns a servlet name into a mapping element
getPatternType
public int getPatternType()
getUrlPattern
public java.lang.String getUrlPattern()
getMappedTo
public java.lang.String getMappedTo()
getLinkName
public java.lang.String getLinkName()
match
public boolean match(java.lang.String inputPattern,
java.lang.StringBuffer servletPath,
java.lang.StringBuffer pathInfo)
- Try to match this pattern against the incoming url
- Parameters:
inputPattern
- The URL we want to check for a matchservletPath
- An empty stringbuffer for the servletPath of a successful matchpathInfo
- An empty stringbuffer for the pathInfo of a successful match
- Returns:
- true if the match is successful
compare
public int compare(java.lang.Object objOne,
java.lang.Object objTwo)
- Used to compare two url patterns. Always sorts so that lowest pattern
type then longest path come first.
- Specified by:
compare
in interface java.util.Comparator
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2013. All Rights Reserved.