當前位置: 首頁>>代碼示例>>Java>>正文


Java UrlPathHelper.getOriginatingContextPath方法代碼示例

本文整理匯總了Java中org.springframework.web.util.UrlPathHelper.getOriginatingContextPath方法的典型用法代碼示例。如果您正苦於以下問題:Java UrlPathHelper.getOriginatingContextPath方法的具體用法?Java UrlPathHelper.getOriginatingContextPath怎麽用?Java UrlPathHelper.getOriginatingContextPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.util.UrlPathHelper的用法示例。


在下文中一共展示了UrlPathHelper.getOriginatingContextPath方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getURI

import org.springframework.web.util.UrlPathHelper; //導入方法依賴的package包/類
/**
 * 獲得第三個路徑分隔符的位置
 * 
 * @param request
 * @throws IllegalStateException
 *             訪問路徑錯誤,沒有三(四)個'/'
 */
private static String getURI(HttpServletRequest request)
		throws IllegalStateException {
	UrlPathHelper helper = new UrlPathHelper();
	String uri = helper.getOriginatingRequestUri(request);
	String ctxPath = helper.getOriginatingContextPath(request);
	int start = 0, i = 0, count = 2;
	if (!StringUtils.isBlank(ctxPath)) {
		count++;
	}
	while (i < count && start != -1) {
		start = uri.indexOf('/', start + 1);
		i++;
	}
	
	if (start <= 0) {
		throw new IllegalStateException(
				"admin access path not like '/jeeadmin/jeecms/...' pattern: "
						+ uri);
	}
	return uri.substring(start);
}
 
開發者ID:huanzhou,項目名稱:jeecms6,代碼行數:29,代碼來源:AdminContextInterceptor.java

示例2: getURI

import org.springframework.web.util.UrlPathHelper; //導入方法依賴的package包/類
/**
 * 獲得第三個路徑分隔符的位置
 * 
 * @param request
 * @throws IllegalStateException
 *             訪問路徑錯誤,沒有三(四)個'/'
 */
private static String getURI(HttpServletRequest request)
		throws IllegalStateException {
	UrlPathHelper helper = new UrlPathHelper();
	String uri = helper.getOriginatingRequestUri(request);
	String ctxPath = helper.getOriginatingContextPath(request);
	int start = 0, i = 0, count = 2;
	if (!StringUtils.isBlank(ctxPath)) {
		count++;
	}
	while (i < count && start != -1) {
		start = uri.indexOf('/', start + 1);
		i++;
	}
	if (start <= 0) {
		throw new IllegalStateException(
				"admin access path not like '/jeeadmin/jspgou/...' pattern: "
						+ uri);
	}
	return uri.substring(start);
}
 
開發者ID:caipiao,項目名稱:Lottery,代碼行數:28,代碼來源:AdminContextInterceptor.java

示例3: getURI

import org.springframework.web.util.UrlPathHelper; //導入方法依賴的package包/類
public static String getURI(HttpServletRequest request) {
	UrlPathHelper helper = new UrlPathHelper();
	String uri = helper.getOriginatingRequestUri(request);
	String ctx = helper.getOriginatingContextPath(request);
	if (!StringUtils.isBlank(ctx)) {
		return uri.substring(ctx.length());
	} else {
		return uri;
	}
}
 
開發者ID:huanzhou,項目名稱:jeecms6,代碼行數:11,代碼來源:URLHelper.java

示例4: getURI

import org.springframework.web.util.UrlPathHelper; //導入方法依賴的package包/類
private static String getURI(HttpServletRequest request) {
	UrlPathHelper helper = new UrlPathHelper();
	String uri = helper.getOriginatingRequestUri(request);
	String ctx = helper.getOriginatingContextPath(request);
	if (!StringUtils.isBlank(ctx)) {
		return uri.substring(ctx.length());
	} else {
		return uri;
	}
}
 
開發者ID:caipiao,項目名稱:Lottery,代碼行數:11,代碼來源:URLHelper.java

示例5: expandBestMatchingPatternMulti

import org.springframework.web.util.UrlPathHelper; //導入方法依賴的package包/類
/**
 * 自動尋找matchingPatternPath 擴充模板值.
 * 
 * <p>
 * urlPathHelper.getOriginatingContextPath(request) + expandUrl + (Validator.isNotNull(queryString) ? "?" + queryString : "");
 * <p>
 * 
 * @param request
 *            the request
 * @param variableName
 *            模板變量
 * @param value
 *            the value
 * @param valueSeparator
 *            多值,分隔符
 * @return 獲得一個新的url,參數部分會被原樣返回<br>
 *         urlPathHelper.getOriginatingContextPath(request) + expandUrl + (Validator.isNotNull(queryString) ? "?" + queryString : "");
 */
public static String expandBestMatchingPatternMulti(HttpServletRequest request,String variableName,String value,String valueSeparator){
    String requestPath = RequestUtil.getOriginatingServletPath(request);
    String matchingPatternPath = UriTemplateUtil.getBestMatchingPattern(request);//TODO 這種方法可能不太好 可能被覆蓋

    String expandUrl = expandWithMultiVariable(requestPath, matchingPatternPath, variableName, value, valueSeparator);

    if (LOGGER.isDebugEnabled()){
        LOGGER.debug(JsonUtil.format(UrlPathHelperUtil.getUrlPathHelperMapForLog(request)));
    }

    String queryString = request.getQueryString();
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    return urlPathHelper.getOriginatingContextPath(request) + expandUrl + (isNullOrEmpty(queryString) ? "?" + queryString : "");
}
 
開發者ID:venusdrogon,項目名稱:feilong-spring,代碼行數:33,代碼來源:MultiUriTemplateUtil.java

示例6: expandBestMatchingPattern

import org.springframework.web.util.UrlPathHelper; //導入方法依賴的package包/類
/**
 * 自動尋找matchingPatternPath 擴充模板值.
 * 
 * <p>
 * urlPathHelper.getOriginatingContextPath(request) + expandUrl + (Validator.isNotNull(queryString) ? "?" + queryString : "");
 * </p>
 * 
 * @param request
 *            the request
 * @param variableName
 *            模板變量
 * @param value
 *            the value
 * @return 獲得一個新的url,參數部分會被原樣返回<br>
 *         urlPathHelper.getOriginatingContextPath(request) + expandUrl + (Validator.isNotNull(queryString) ? "?" + queryString : "");
 *
 * @see #getBestMatchingPattern(HttpServletRequest)
 * @see RequestUtil#getOriginatingServletPath(HttpServletRequest)
 */
public static String expandBestMatchingPattern(HttpServletRequest request,String variableName,String value){
    String requestPath = RequestUtil.getOriginatingServletPath(request);
    String matchingPatternPath = getBestMatchingPattern(request);// 這種方法可能不太好 可能被覆蓋

    String expandUrl = expandWithVariable(requestPath, matchingPatternPath, variableName, value);

    if (LOGGER.isDebugEnabled()){
        LOGGER.debug(JsonUtil.format(UrlPathHelperUtil.getUrlPathHelperMapForLog(request)));
    }

    String queryString = request.getQueryString();
    UrlPathHelper urlPathHelper = new UrlPathHelper();
    return urlPathHelper.getOriginatingContextPath(request) + expandUrl + (isNullOrEmpty(queryString) ? "?" + queryString : "");
}
 
開發者ID:venusdrogon,項目名稱:feilong-spring,代碼行數:34,代碼來源:UriTemplateUtil.java


注:本文中的org.springframework.web.util.UrlPathHelper.getOriginatingContextPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。