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


Java HttpMethod.valueOf方法代碼示例

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


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

示例1: doFilter

import org.springframework.http.HttpMethod; //導入方法依賴的package包/類
@Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
	final HttpServletRequest httpRequest = (HttpServletRequest) request;

	/**
	 * This is the most serious place of security check. If this filter is called, it means the previous security
	 * checks granted access until there. So, it mean the current user is either anonymous either (but assumed) an
	 * fully authenticated user. In case of anonymous user case, there is no role but ROLE_ANONYMOUS. So there is no
	 * need to involve more role checking. We assume there is no way to grant access to ROLE_ANONYMOUS with this
	 * filter.
	 */
	final Collection<? extends GrantedAuthority> authorities = SecurityContextHolder.getContext().getAuthentication().getAuthorities();
	if (!authorities.contains(new SimpleGrantedAuthority("ROLE_ANONYMOUS"))) {
		// Not anonymous, so we need to check using RBAC strategy.

		// Build the URL
		final String fullRequest = getFullRequest(httpRequest);
		// Check access
		final HttpMethod method = HttpMethod.valueOf(StringUtils.upperCase(httpRequest.getMethod(), Locale.ENGLISH));
		if (!isAuthorized(authorities, fullRequest, method)) {
			// Forbidden access
			updateForbiddenAccess((HttpServletResponse) response);
			return;
		}
	}

	// Granted access, continue
	chain.doFilter(request, response);
}
 
開發者ID:ligoj,項目名稱:bootstrap,代碼行數:30,代碼來源:AuthorizingFilter.java

示例2: getRequestMethod

import org.springframework.http.HttpMethod; //導入方法依賴的package包/類
@Override
public HttpMethod getRequestMethod() {
	return HttpMethod.valueOf(getRequest().getMethod());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:AbstractMultipartHttpServletRequest.java

示例3: getMethod

import org.springframework.http.HttpMethod; //導入方法依賴的package包/類
@Override
public HttpMethod getMethod() {
	return HttpMethod.valueOf(this.httpRequest.getMethod());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:HttpComponentsClientHttpRequest.java

示例4: getMethod

import org.springframework.http.HttpMethod; //導入方法依賴的package包/類
@Override
public HttpMethod getMethod() {
	return HttpMethod.valueOf(this.connection.getRequestMethod());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:SimpleStreamingAsyncClientHttpRequest.java

示例5: getMethod

import org.springframework.http.HttpMethod; //導入方法依賴的package包/類
@Override
public HttpMethod getMethod() {
	return HttpMethod.valueOf(this.servletRequest.getMethod());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:5,代碼來源:ServletServerHttpRequest.java

示例6: method

import org.springframework.http.HttpMethod; //導入方法依賴的package包/類
public HttpMethod method() {
    return HttpMethod.valueOf(request.getMethod());
}
 
開發者ID:membrane,項目名稱:membrane-spring-boot-starter,代碼行數:4,代碼來源:RequestWrapper.java

示例7: getHttpMethod

import org.springframework.http.HttpMethod; //導入方法依賴的package包/類
/**
 * Return the HTTP method of the request.
 * @since 4.0.2
 */
public HttpMethod getHttpMethod() {
	return HttpMethod.valueOf(getRequest().getMethod().trim().toUpperCase());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:8,代碼來源:ServletWebRequest.java


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