Interface SessionInjector<A,B extends Session<A>,C extends ExchangeContext,D extends Exchange<C>>

Type Parameters:
A - the session data type
B - the session type
C - the exchange context type
D - the exchange type
All Known Implementing Classes:
CookieSessionInjector
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SessionInjector<A,B extends Session<A>,C extends ExchangeContext,D extends Exchange<C>>

A session injector injects or removes the session identifier from an exchange.

It is used by the SessionInterceptor to inject the session identifier in the exchange when a new session is created or if the session identifier has been refreshed and to remove the session identifier from the exchange when the session has been invalidated.

Since:
1.13
Author:
Jeremy Kuhn
  • Method Summary

    Modifier and Type
    Method
    Description
    default SessionInjector<A,B,C,D>
    andThen(SessionInjector<? super A,? super B,? super C,? super D> after)
    Invokes this session injector and then invokes the specified session injector.
    default SessionInjector<A,B,C,D>
    compose(SessionInjector<? super A,? super B,? super C,? super D> before)
    Invokes the specified session injector and then invokes this session injector.
    inject(D exchange, B session)
    Injects the specified session into the exchange.
    static <A, B extends Session<A>, C extends ExchangeContext, D extends Exchange<C>>
    SessionInjector<A,B,C,D>
    of(SessionInjector<? super A,? super B,? super C,? super D>... injectors)
    Returns a composed session injector that invokes the specified injectors in sequence.
    default Mono<Void>
    remove(D exchange)
    Removes the session from the exchange.
  • Method Details

    • inject

      Mono<Void> inject(D exchange, B session)

      Injects the specified session into the exchange.

      Parameters:
      exchange - the exchange
      session - the session
      Returns:
      a mono which completes when the session has been injected
    • remove

      default Mono<Void> remove(D exchange)

      Removes the session from the exchange.

      Parameters:
      exchange - the exchange
      Returns:
      a mono which completes when the session has been removed
    • andThen

      default SessionInjector<A,B,C,D> andThen(SessionInjector<? super A,? super B,? super C,? super D> after)

      Invokes this session injector and then invokes the specified session injector.

      Parameters:
      after - the injector to invoke after this injector
      Returns:
      a composed session injector that invokes in sequence this injector followed by the specified injector
    • compose

      default SessionInjector<A,B,C,D> compose(SessionInjector<? super A,? super B,? super C,? super D> before)

      Invokes the specified session injector and then invokes this session injector.

      Parameters:
      before - the injector to invoke before this injector
      Returns:
      a composed session injector that invokes in sequence the specified injector followed by this injector
    • of

      @SafeVarargs static <A, B extends Session<A>, C extends ExchangeContext, D extends Exchange<C>> SessionInjector<A,B,C,D> of(SessionInjector<? super A,? super B,? super C,? super D>... injectors)

      Returns a composed session injector that invokes the specified injectors in sequence.

      Type Parameters:
      A - the session data type
      B - the session type
      C - the exchange context type
      D - the exchange type
      Parameters:
      injectors - the list of injectors to invoke in sequence
      Returns:
      a composed session injector that invokes the specified injectors in sequence