解决静态路径问题

This commit is contained in:
gy b
2023-09-15 20:06:01 +08:00
parent 857ae6a0a1
commit 04d9172cce
2 changed files with 7 additions and 11 deletions
@@ -2,6 +2,7 @@ package com.ruoyi.common.enums;
import java.util.HashMap;
import java.util.Map;
import org.springframework.lang.Nullable;
/**
@@ -9,28 +10,23 @@ import org.springframework.lang.Nullable;
*
* @author ruoyi
*/
public enum HttpMethod
{
public enum HttpMethod {
GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
private static final Map<String, HttpMethod> mappings = new HashMap<>(16);
static
{
for (HttpMethod httpMethod : values())
{
static {
for (HttpMethod httpMethod : values()) {
mappings.put(httpMethod.name(), httpMethod);
}
}
@Nullable
public static HttpMethod resolve(@Nullable String method)
{
public static HttpMethod resolve(@Nullable String method) {
return (method != null ? mappings.get(method) : null);
}
public boolean matches(String method)
{
public boolean matches(String method) {
return (this == resolve(method));
}
}