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

com.fujieid.jap.http.JapHttpSession Maven / Gradle / Ivy

package com.fujieid.jap.http;

/**
 * Define an interface to adapt to session objects of different frameworks,
 * such as: javax.servlet.http.HttpSession or com.blade.mvc.http.Session
 *
 * @author yadong.zhang (yadong.zhang0415(a)gmail.com)
 * @version 1.0.0
 * @since 1.0.5
 */
public interface JapHttpSession {

    /**
     * Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.
     *
     * @return a long specifying when this session was created, expressed in milliseconds since 1/1/1970
     * GMT
     */
    long getCreationTime();

    /**
     * Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the
     * servlet container and is implementation dependent.
     *
     * @return a string specifying the identifier assigned to this session
     */
    String getId();

    /**
     * Returns the object bound with the specified name in this session, or null if no object is bound
     * under the name.
     *
     * @param name a string specifying the name of the object
     * @return the object with the specified name
     */
    Object getAttribute(String name);

    /**
     * Binds an object to this session, using the name specified. If an object of the same name is already bound to the
     * session, the object is replaced.
     *
     * @param name  the name to which the object is bound; cannot be null
     * @param value the object to be bound; cannot be null
     */
    void setAttribute(String name, Object value);

    /**
     * Removes the object bound with the specified name from this session. If the session does not have an object bound
     * with the specified name, this method does nothing.
     *
     * @param name the name of the object to remove from this session
     */
    void removeAttribute(String name);

    /**
     * Invalidates this session then unbinds any objects bound to it.
     */
    void invalidate();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy