Class Session

java.lang.Object
io.mangoo.routing.bindings.Session

public class Session extends Object
Author:
svenkubiak
  • Constructor Details

    • Session

      public Session()
  • Method Details

    • create

      public static Session create()
    • withContent

      public Session withContent(Map<String,String> values)
    • withExpires

      public Session withExpires(LocalDateTime expires)
    • invalidate

      public void invalidate()
      Invalidates the session by sending expiring the client cookie
    • hasContent

      public boolean hasContent()
      Checks if the session has at least one entry
      Returns:
      True if the session has at least one entry, false otherwise
    • get

      public String get(String key)
      Retrieves a specific value from the session
      Parameters:
      key - The key
      Returns:
      The value or null if none present
    • getValues

      public Map<String,String> getValues()
      Returns:
      All values of the session
    • getExpires

      public LocalDateTime getExpires()
      Returns:
      The expiry date of the session
    • put

      public void put(String key, String value)
      Adds a value to the session, overwriting an existing value
      Parameters:
      key - The key to store the value
      value - The value to store
    • remove

      public void remove(String key)
      Removes a value with a given key from the session
      Parameters:
      key - The key to remove
    • clear

      public void clear()
      Clears the complete session
    • hasChanges

      public boolean hasChanges()
      Returns:
      True if a session values has change, be removed or the session has been cleared, false otherwise
    • isInvalid

      public boolean isInvalid()