Interface Plugin

All Known Implementing Classes:
OriginalStackTracePlugin

@API(status=MAINTAINED) public interface Plugin
Plugins allow to modify executions of requests in order to inject specific behaviour. The chronological order of phases is
Async
Phases afterwards are executed asynchronously.
Dispatch
Performs the response routing onto the supplied routing tree upon receiving a response.
Serialization
Serialization of the request body.
Network
The actual network communication.
The nature of request executions allows plugins to inject behavior before, after and even during the execution on a request.
See Also:
  • Method Details

    • aroundAsync

      default RequestExecution aroundAsync(RequestExecution execution)
      The given execution will be executed in a different thread and therefore be properly asynchronous. This phase is useful for plugins which either need to perform some task in the calling thread or (more commonly) may trigger other asynchronous operations concurrently to the request.
      Parameters:
      execution - the execution that includes the thread switch as well as the dispatch, serialization and network phases
      Returns:
      the new, potentially modified execution
    • aroundDispatch

      default RequestExecution aroundDispatch(RequestExecution execution)
      The given execution will have the response already being dispatched onto the given Route. Any exceptions that were produced from the response will be observable in this stage.
      Parameters:
      execution - the execution that includes the dispatch, serialization and network phase
      Returns:
      the new, potentially modified execution
    • aroundSerialization

      default RequestExecution aroundSerialization(RequestExecution execution)
      The given execution will have the request body already serialized into bytes.
      Parameters:
      execution - the execution that includes serialization and network phase
      Returns:
      the new, potentially modified execution
    • aroundNetwork

      default RequestExecution aroundNetwork(RequestExecution execution)
      The given execution will include the pure network communication. Any exceptions that were the result of writing to and reading from the TCP socket will be observable in this stage.
      Parameters:
      execution - the execution that includes the network communication
      Returns:
      the new, potentially modified execution
    • composite

      static Plugin composite(Plugin... plugins)
    • composite

      static Plugin composite(List<Plugin> plugins)