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

org.wildfly.clustering.web.session.ImmutableSessionMetaData Maven / Gradle / Ivy

Go to download

A set of SPIs for implementing a container-independent distributable HTTP session manager and single sign-on manager for use by a servlet container.

The newest version!
/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package org.wildfly.clustering.web.session;

import java.time.Instant;

import org.wildfly.clustering.ee.expiration.ExpirationMetaData;

/**
 * Abstraction for immutable meta information about a web session.
 * @author Paul Ferraro
 */
public interface ImmutableSessionMetaData extends ExpirationMetaData {

    /**
     * Indicates whether or not this session was created by the current thread.
     * @return true, if this session is new, false otherwise
     */
    default boolean isNew() {
        return this.getLastAccessStartTime().equals(this.getLastAccessEndTime());
    }

    /**
     * Returns the time this session was created.
     * @return the time this session was created
     */
    Instant getCreationTime();

    /**
     * Returns the start time of the last request to access this session.
     * @return the start time of the last request to access this session.
     */
    Instant getLastAccessStartTime();

    /**
     * Returns the start time of the last request to access this session.
     * @return the start time of the last request to access this session.
     */
    Instant getLastAccessEndTime();

    @Override
    default Instant getLastAccessTime() {
        return this.getLastAccessEndTime();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy