All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.guerlab.cloud.web.webmvc.interceptor.ContextAttributesHolderCleanInterceptor Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2018-2025 guerlab.net and other contributors.
 *
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.gnu.org/licenses/lgpl-3.0.html
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.guerlab.cloud.web.webmvc.interceptor;

import jakarta.annotation.Nullable;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;

import org.springframework.web.servlet.HandlerInterceptor;

import net.guerlab.cloud.context.core.ContextAttributesHolder;

/**
 * 上下文属性保持器清理拦截器.
 *
 * @author guer
 */
@Slf4j
public class ContextAttributesHolderCleanInterceptor implements HandlerInterceptor {

	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
			@Nullable Exception ex) {
		ContextAttributesHolder.get().clear();
		log.debug("invoke ContextAttributesHolder.get().clear()");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy