Class TransactionalStateSupport

java.lang.Object
org.sourceid.saml20.adapter.state.TransactionalStateSupport

public class TransactionalStateSupport extends Object
Provides state persistence functionality for user attributes between HTTP invocations to the server on a per transaction basis. This class is similar to SessionStateSupport but the attributes are only available though the course of a single transaction rather than for a full session. The scope of a transaction is a single set of interactions between the server and an adapter to accomplish a single task (i.e. looking up a login context, even when spanning multiple HTTP request/response interactions, is a single transactional context).
Transactional state is maintained using the same underlying mechanisms at SessionStateSupport but with an additional qualifier on the key to distinguish one transaction from another. This enables better support for concurrent and nested transactions. The transactional qualifier is a short opaque value encoded into the resume path that is passed to the adapter in front channel invocations.
There are some server configurations where transactional state differentiation is not possible. In those cases, use of this API will default to behaving like SessionStateSupport.
Attributes must be added or updated using the setAttribute(String, Object, HttpServletRequest, HttpServletResponse) or removeAttribute(String, HttpServletRequest, HttpServletResponse) methods before the associated HttpServletResponse response is committed.
It's recommended that clients of this API 'clean up after themselves' and remove attributes when finished with them.
Since:
6.5
  • Constructor Details

  • Method Details

    • setAttribute

      @Deprecated(since="13.1", forRemoval=true) public void setAttribute(String name, Object value, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets a named attribute for the user's transactional context.
      Parameters:
      name - the name of the attribute
      value - value the attribute value
      req - HTTP request
      resp - HTTP response
      Since:
      6.5
    • setAttribute

      public void setAttribute(String name, Object value, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
      Sets a named attribute for the user's transactional context.
      Parameters:
      name - the name of the attribute
      value - value the attribute value
      req - HTTP request
      resp - HTTP response
      Since:
      13.1
    • getAttribute

      @Deprecated(since="13.1", forRemoval=true) public Object getAttribute(String name, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Retrieves a named attribute from the user's transactional context.
      Parameters:
      name - the name of the attribute
      req - HTTP request
      resp - HTTP response
      Returns:
      the value of the attribute as previously set by setAttribute(String, Object, HttpServletRequest, HttpServletResponse), or null if the attribute was never set, was removed via removeAttribute(String, HttpServletRequest, HttpServletResponse), or if transactional context has been lost.
      Since:
      6.5
    • getAttribute

      public Object getAttribute(String name, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
      Retrieves a named attribute from the user's transactional context.
      Parameters:
      name - the name of the attribute
      req - HTTP request
      resp - HTTP response
      Returns:
      the value of the attribute as previously set by setAttribute(String, Object, HttpServletRequest, HttpServletResponse), or null if the attribute was never set, was removed via removeAttribute(String, HttpServletRequest, HttpServletResponse), or if transactional context has been lost.
      Since:
      13.1
    • removeAttribute

      @Deprecated(since="13.1", forRemoval=true) public Object removeAttribute(String name, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Removes the named attribute from the user's transactional context.
      Parameters:
      name - the name of the attribute
      req - HTTP request
      resp - HTTP response
      Returns:
      the value of the attribute that was removed, if it exists, null otherwise.
      Since:
      6.5
    • removeAttribute

      public Object removeAttribute(String name, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
      Removes the named attribute from the user's transactional context.
      Parameters:
      name - the name of the attribute
      req - HTTP request
      resp - HTTP response
      Returns:
      the value of the attribute that was removed, if it exists, null otherwise.
      Since:
      13.1
    • getTransactionalContextId

      public String getTransactionalContextId()
      Gets the transactional qualifier id that was embedded/encoded into the resume path.
      Returns:
      transactional qualifier id or null if no such qualifier was not present.
    • hasTransactionalContextId

      public boolean hasTransactionalContextId()
      Indicates if a transactional qualifier id embedded/encoded into the resume path.
      Returns:
      true if the resume path contains such an id, and false otherwise.