class WebUtils extends org.springframework.web.util.WebUtils {

	private final String BASIC_ = "Basic ";

	private final String UNKNOWN = "unknown";

	/**
	 * 判断是否ajax请求 spring ajax 返回含有 ResponseBody 或者 RestController注解
	 * @param handlerMethod HandlerMethod
	 * @return 是否ajax请求
	 */
	public boolean isBody(HandlerMethod handlerMethod) {
		ResponseBody responseBody = ClassUtils.getAnnotation(handlerMethod, ResponseBody.class);
		return responseBody != null;
	}

	/**
	 * 读取cookie
	 * @param name cookie name
	 * @return cookie value
	 */
	public String getCookieVal(String name) {
		if (WebUtils.getRequest().isPresent()) {
			return getCookieVal(WebUtils.getRequest().get(), name);
		}
		return null;
	}

	/**
	 * 读取cookie
	 * @param request HttpServletRequest
	 * @param name cookie name
	 * @return cookie value
	 */
	public String getCookieVal(HttpServletRequest request, String name) {
		Cookie cookie = getCookie(request, name);
		return cookie != null ? cookie.getValue() : null;
	}

	/**
	 * 清除 某个指定的cookie
	 * @param response HttpServletResponse
	 * @param key cookie key
	 */
	public void removeCookie(HttpServletResponse response, String key) {
		setCookie(response, key, null, 0);
	}

	/**
	 * 设置cookie
	 * @param response HttpServletResponse
	 * @param name cookie name
	 * @param value cookie value
	 * @param maxAgeInSeconds maxage
	 */
	public void setCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
		Cookie cookie = new Cookie(name, value);
		cookie.setPath("/");
		cookie.setMaxAge(maxAgeInSeconds);
		cookie.setHttpOnly(true);
		response.addCookie(cookie);
	}

	/**
	 * 获取 HttpServletRequest
	 * @return {HttpServletRequest}
	 */
	public Optional<HttpServletRequest> getRequest() {
		return Optional
			.ofNullable(((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
	}

	/**
	 * 获取 HttpServletResponse
	 * @return {HttpServletResponse}
	 */
	public HttpServletResponse getResponse() {
		return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
	}

	/**
	 * 从request 获取CLIENT_ID
	 * @return
	 */
	@SneakyThrows
	public String getClientId(ServerHttpRequest request) {
		String header = request.getHeaders().getFirst(HttpHeaders.AUTHORIZATION);
		return splitClient(header)[0];
	}

	@SneakyThrows
	public String getClientId() {
		if (WebUtils.getRequest().isPresent()) {
			String header = WebUtils.getRequest().get().getHeader(HttpHeaders.AUTHORIZATION);
			return splitClient(header)[0];
		}
		return null;
	}

	@NotNull
	private static String[] splitClient(String header) {<FILL_FUNCTION_BODY>}

}

		if (header == null || !header.startsWith(BASIC_)) {
			throw new CheckedException("请求头中client信息为空");
		}
		byte[] base64Token = header.substring(6).getBytes(StandardCharsets.UTF_8);
		byte[] decoded;
		try {
			decoded = Base64.decode(base64Token);
		}
		catch (IllegalArgumentException e) {
			throw new CheckedException("Failed to decode basic authentication token");
		}

		String token = new String(decoded, StandardCharsets.UTF_8);

		int delim = token.indexOf(":");

		if (delim == -1) {
			throw new CheckedException("Invalid basic authentication token");
		}
		return new String[] { token.substring(0, delim), token.substring(delim + 1) };
	
<methods>public void <init>() ,public static void clearErrorRequestAttributes(jakarta.servlet.http.HttpServletRequest) ,public static void exposeErrorRequestAttributes(jakarta.servlet.http.HttpServletRequest, java.lang.Throwable, java.lang.String) ,public static java.lang.String findParameterValue(jakarta.servlet.ServletRequest, java.lang.String) ,public static java.lang.String findParameterValue(Map<java.lang.String,?>, java.lang.String) ,public static jakarta.servlet.http.Cookie getCookie(jakarta.servlet.http.HttpServletRequest, java.lang.String) ,public static java.lang.Boolean getDefaultHtmlEscape(jakarta.servlet.ServletContext) ,public static T getNativeRequest(jakarta.servlet.ServletRequest, Class<T>) ,public static T getNativeResponse(jakarta.servlet.ServletResponse, Class<T>) ,public static Map<java.lang.String,java.lang.Object> getParametersStartingWith(jakarta.servlet.ServletRequest, java.lang.String) ,public static java.lang.String getRealPath(jakarta.servlet.ServletContext, java.lang.String) throws java.io.FileNotFoundException,public static java.lang.Object getRequiredSessionAttribute(jakarta.servlet.http.HttpServletRequest, java.lang.String) throws java.lang.IllegalStateException,public static java.lang.Boolean getResponseEncodedHtmlEscape(jakarta.servlet.ServletContext) ,public static java.lang.Object getSessionAttribute(jakarta.servlet.http.HttpServletRequest, java.lang.String) ,public static java.lang.String getSessionId(jakarta.servlet.http.HttpServletRequest) ,public static java.lang.Object getSessionMutex(jakarta.servlet.http.HttpSession) ,public static java.io.File getTempDir(jakarta.servlet.ServletContext) ,public static boolean hasSubmitParameter(jakarta.servlet.ServletRequest, java.lang.String) ,public static boolean isIncludeRequest(jakarta.servlet.ServletRequest) ,public static boolean isSameOrigin(org.springframework.http.HttpRequest) ,public static boolean isValidOrigin(org.springframework.http.HttpRequest, Collection<java.lang.String>) ,public static MultiValueMap<java.lang.String,java.lang.String> parseMatrixVariables(java.lang.String) ,public static void removeWebAppRootSystemProperty(jakarta.servlet.ServletContext) ,public static void setSessionAttribute(jakarta.servlet.http.HttpServletRequest, java.lang.String, java.lang.Object) ,public static void setWebAppRootSystemProperty(jakarta.servlet.ServletContext) throws java.lang.IllegalStateException<variables>public static final java.lang.String CONTENT_TYPE_CHARSET_PREFIX,public static final java.lang.String DEFAULT_CHARACTER_ENCODING,public static final java.lang.String DEFAULT_WEB_APP_ROOT_KEY,public static final java.lang.String ERROR_EXCEPTION_ATTRIBUTE,public static final java.lang.String ERROR_EXCEPTION_TYPE_ATTRIBUTE,public static final java.lang.String ERROR_MESSAGE_ATTRIBUTE,public static final java.lang.String ERROR_REQUEST_URI_ATTRIBUTE,public static final java.lang.String ERROR_SERVLET_NAME_ATTRIBUTE,public static final java.lang.String ERROR_STATUS_CODE_ATTRIBUTE,public static final java.lang.String FORWARD_CONTEXT_PATH_ATTRIBUTE,public static final java.lang.String FORWARD_PATH_INFO_ATTRIBUTE,public static final java.lang.String FORWARD_QUERY_STRING_ATTRIBUTE,public static final java.lang.String FORWARD_REQUEST_URI_ATTRIBUTE,public static final java.lang.String FORWARD_SERVLET_PATH_ATTRIBUTE,public static final java.lang.String HTML_ESCAPE_CONTEXT_PARAM,public static final java.lang.String INCLUDE_CONTEXT_PATH_ATTRIBUTE,public static final java.lang.String INCLUDE_PATH_INFO_ATTRIBUTE,public static final java.lang.String INCLUDE_QUERY_STRING_ATTRIBUTE,public static final java.lang.String INCLUDE_REQUEST_URI_ATTRIBUTE,public static final java.lang.String INCLUDE_SERVLET_PATH_ATTRIBUTE,public static final java.lang.String RESPONSE_ENCODED_HTML_ESCAPE_CONTEXT_PARAM,public static final java.lang.String SESSION_MUTEX_ATTRIBUTE,public static final java.lang.String[] SUBMIT_IMAGE_SUFFIXES,public static final java.lang.String TEMP_DIR_CONTEXT_ATTRIBUTE,public static final java.lang.String WEB_APP_ROOT_KEY_PARAM