本文整理匯總了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());
}