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

io.dropwizard.jersey.sessions.HttpSessionFactory Maven / Gradle / Ivy

The newest version!
package io.dropwizard.jersey.sessions;

import jakarta.inject.Inject;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import org.checkerframework.checker.nullness.qual.Nullable;

public final class HttpSessionFactory {
    private final HttpServletRequest request;

    @Inject
    public HttpSessionFactory(HttpServletRequest request) {
        this.request = request;
    }

    @Nullable
    public HttpSession provide(boolean doNotCreate) {
        if (request == null) {
            return null;
        }

        return request.getSession(!doNotCreate);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy