|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.tinygroup.weblayer.webcontext.util.ServletUtil
public class ServletUtil
有关servlet的小工具。
| 构造方法摘要 | |
|---|---|
ServletUtil()
|
|
| 方法摘要 | |
|---|---|
static String |
getBaseURL(javax.servlet.http.HttpServletRequest request)
取得request请求的基准URL。 |
static String |
getResourcePath(javax.servlet.http.HttpServletRequest request)
取得request所请求的资源路径。 |
static String |
getServletBaseURL(javax.servlet.http.HttpServletRequest request)
取得request请求的基准URL。 |
static String |
getServletResourcePath(javax.servlet.http.HttpServletRequest request)
取得request所请求的资源路径。 |
static boolean |
isPrefixServletMapping(javax.servlet.http.HttpServletRequest request)
判断servlet是否为前缀映射。 |
static String |
normalizeURI(String uri)
规格化URI。 |
static boolean |
startsWithPath(String path,
String fullpath)
判断path是否为fullpath的前缀,匹配到“/”边界。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public ServletUtil()
| 方法详细信息 |
|---|
public static boolean isPrefixServletMapping(javax.servlet.http.HttpServletRequest request)
Servlet mapping有两种匹配方式:前缀匹配和后缀匹配。
public static String getResourcePath(javax.servlet.http.HttpServletRequest request)
资源路径为getServletPath() + getPathInfo()。
注意,ResourcePath以"/"开始,如果无内容,则返回空字符串
""。
public static String getBaseURL(javax.servlet.http.HttpServletRequest request)
基准URL等同于SERVER/contextPath。
基准URL总是不以"/"结尾。
以下等式总是成立:fullURL = baseURL + resourcePath。
public static String getServletResourcePath(javax.servlet.http.HttpServletRequest request)
getPathInfo()。例如映射
/turbine/*:/turbine/xx/yy的resource path为
/xx/yy。getServletPath()。例如映射
*.do:/xx/yy.do的resource path为
/xx/yy.do。
注意,ResourcePath以"/"开始,如果无内容,则返回空字符串
""。
本方法适用于servlet-mapping对应的URL。
public static String getServletBaseURL(javax.servlet.http.HttpServletRequest request)
SERVER/contextPath/servletPath。例如映射
/turbine/*:http://localhost/myapp/turbine/xx/yy
的baseURL为 http://localhost/myapp/turbine。SERVER/contextPath。例如映射
*.do:http://localhost/myapp/xx/yy.do的baseURL为
http://localhost/myapp。
基准URL总是不以"/"结尾。
以下等式总是成立:fullURL = servletBaseURL + servletResourcePath。
本方法适用于servlet-mapping对应的URL。
public static String normalizeURI(String uri)
public static boolean startsWithPath(String path,
String fullpath)
startsWithPath("/index", "/index.htm") == false。startsWithPath("/path", "/path/index") == true。
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||