当前位置: 首页>>代码示例>>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;未经允许,请勿转载。