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

io.soffa.foundation.commons.http.HttpContextHolder Maven / Gradle / Ivy

package io.soffa.foundation.commons.http;

import java.util.Map;
import java.util.Optional;

public class HttpContextHolder {

    private static final ThreadLocal> CURRENT = new InheritableThreadLocal<>();

    public static void set(Map value) {
        if (value == null) {
            CURRENT.remove();
        } else {
            CURRENT.set(value);
        }
    }

    public static void clear() {
        CURRENT.remove();
    }

    public static boolean isEmpty() {
        return CURRENT.get() == null;
    }

    public static Optional> get() {
        return Optional.ofNullable(CURRENT.get());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy