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

com.deepexi.devops.proxy.util.ThreadLocalUtils Maven / Gradle / Ivy

The newest version!
package com.deepexi.devops.proxy.util;

import com.deepexi.devops.proxy.RequestContext;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author taccisum - [email protected]
 * @since 2019-11-13
 */
public abstract class ThreadLocalUtils {
    private static ThreadLocal context = new ThreadLocal<>();

    public static RequestContext getRequestContext(HttpServletRequest request, HttpServletResponse response) {
        if (context.get() == null) {
            context.set(new RequestContext(request, response));
        }
        return context.get();
    }

    public static void clearRequestContext() {
        context.remove();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy