org.tinygroup.weblayer.webcontext.util
类 ServletUtil

java.lang.Object
  继承者 org.tinygroup.weblayer.webcontext.util.ServletUtil

public class ServletUtil
extends Object

有关servlet的小工具。

作者:
Michael Zhou

构造方法摘要
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
 

构造方法详细信息

ServletUtil

public ServletUtil()
方法详细信息

isPrefixServletMapping

public static boolean isPrefixServletMapping(javax.servlet.http.HttpServletRequest request)
判断servlet是否为前缀映射。

Servlet mapping有两种匹配方式:前缀匹配和后缀匹配。


getResourcePath

public static String getResourcePath(javax.servlet.http.HttpServletRequest request)
取得request所请求的资源路径。

资源路径为getServletPath() + getPathInfo()

注意,ResourcePath"/"开始,如果无内容,则返回空字符串 ""


getBaseURL

public static String getBaseURL(javax.servlet.http.HttpServletRequest request)
取得request请求的基准URL。

基准URL等同于SERVER/contextPath

基准URL总是"/"结尾。

以下等式总是成立:fullURL = baseURL + resourcePath


getServletResourcePath

public static String getServletResourcePath(javax.servlet.http.HttpServletRequest request)
取得request所请求的资源路径。

注意,ResourcePath"/"开始,如果无内容,则返回空字符串 ""

本方法适用于servlet-mapping对应的URL。


getServletBaseURL

public static String getServletBaseURL(javax.servlet.http.HttpServletRequest request)
取得request请求的基准URL。

基准URL总是"/"结尾。

以下等式总是成立:fullURL = servletBaseURL + servletResourcePath

本方法适用于servlet-mapping对应的URL。


normalizeURI

public static String normalizeURI(String uri)
规格化URI。


startsWithPath

public static boolean startsWithPath(String path,
                                     String fullpath)
判断path是否为fullpath的前缀,匹配到“/”边界。



Copyright © 2006–2014 开源组织. All rights reserved.