本文整理汇总了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);
}
示例2: getRequestMethod
import org.springframework.http.HttpMethod; //导入方法依赖的package包/类
@Override
public HttpMethod getRequestMethod() {
return HttpMethod.valueOf(getRequest().getMethod());
}
示例3: getMethod
import org.springframework.http.HttpMethod; //导入方法依赖的package包/类
@Override
public HttpMethod getMethod() {
return HttpMethod.valueOf(this.httpRequest.getMethod());
}
示例4: getMethod
import org.springframework.http.HttpMethod; //导入方法依赖的package包/类
@Override
public HttpMethod getMethod() {
return HttpMethod.valueOf(this.connection.getRequestMethod());
}
示例5: getMethod
import org.springframework.http.HttpMethod; //导入方法依赖的package包/类
@Override
public HttpMethod getMethod() {
return HttpMethod.valueOf(this.servletRequest.getMethod());
}
示例6: method
import org.springframework.http.HttpMethod; //导入方法依赖的package包/类
public HttpMethod method() {
return HttpMethod.valueOf(request.getMethod());
}
示例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());
}