Top Fields Constructors Methods
org.eclipse.jetty.client.transport

public Class HttpConversation

extends Lazy
Class Inheritance
Imports
java.util.Deque, java.util.concurrent.ConcurrentLinkedDeque, org.eclipse.jetty.client.AuthenticationProtocolHandler, .RedirectProtocolHandler, .Request, .Response, org.eclipse.jetty.util.Attributes, .Promise, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private final Deque<HttpExchange>
private volatile ResponseListeners
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
abort(Throwable cause, Promise<Boolean> promise)

public Deque<HttpExchange>
public ResponseListeners

Returns:

the list of response listeners that needs to be notified of response events
getResponseListeners
()

Returns the list of response listeners that needs to be notified of response events.

public long

Returns:

the total timeout of the conversation
getTimeout
()

Returns the total timeout for the conversation.

public String
toString()

Overrides org.eclipse.jetty.util.Attributes.Lazy.toString.

Returns a string representation of the object.

public void
updateResponseListeners(Response.Listener
the override response listener
overrideListener
)

Requests to update the response listener, eventually using the given override response listener, that must be notified instead of the first exchange response listeners.

Inherited from org.eclipse.jetty.util.Attributes.Lazy:
addAllasAttributeMapclearAttributesdumpdumpequalsgetAttributegetAttributeNameSethashCoderemoveAttributesetAttributesize

Field Detail

exchangesback to summary
private final Deque<HttpExchange> exchanges
listenersback to summary
private volatile ResponseListeners listeners
LOGback to summary
private static final Logger LOG

Constructor Detail

HttpConversationback to summary
public HttpConversation()

Method Detail

abortback to summary
public void abort(Throwable cause, Promise<Boolean> promise)
getExchangesback to summary
public Deque<HttpExchange> getExchanges()
getResponseListenersback to summary
public ResponseListeners getResponseListeners()

Returns the list of response listeners that needs to be notified of response events. This list changes as the conversation proceeds, as follows:

  1. request R1 send => conversation.updateResponseListeners(null)
    • exchanges in conversation: E1
    • listeners to be notified: E1.listeners
  2. response R1 arrived, 401 => conversation.updateResponseListeners(AuthenticationProtocolHandler.listener)
    • exchanges in conversation: E1
    • listeners to be notified: AuthenticationProtocolHandler.listener
  3. request R2 send => conversation.updateResponseListeners(null)
    • exchanges in conversation: E1 + E2
    • listeners to be notified: E2.listeners + E1.listeners
  4. response R2 arrived, 302 => conversation.updateResponseListeners(RedirectProtocolHandler.listener)
    • exchanges in conversation: E1 + E2
    • listeners to be notified: E2.listeners + RedirectProtocolHandler.listener
  5. request R3 send => conversation.updateResponseListeners(null)
    • exchanges in conversation: E1 + E2 + E3
    • listeners to be notified: E3.listeners + E1.listeners
  6. response R3 arrived, 200 => conversation.updateResponseListeners(null)
    • exchanges in conversation: E1 + E2 + E3
    • listeners to be notified: E3.listeners + E1.listeners
Basically the override conversation listener replaces the first exchange response listener, and we also notify the last exchange response listeners (if it's not also the first). This scheme allows for protocol handlers to not worry about other protocol handlers, or to worry too much about notifying the first exchange response listeners, but still allowing a protocol handler to perform completion activities while another protocol handler performs new ones (as an example, the AuthenticationProtocolHandler stores the successful authentication credentials while the RedirectProtocolHandler performs a redirect).
Returns:ResponseListeners

the list of response listeners that needs to be notified of response events

getTimeoutback to summary
public long getTimeout()

Returns the total timeout for the conversation.

The conversation total timeout is the total timeout of the first request in the conversation.

Returns:long

the total timeout of the conversation

See Also
Request#getTimeout()
toStringback to summary
public String toString()

Overrides org.eclipse.jetty.util.Attributes.Lazy.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
updateResponseListenersback to summary
public void updateResponseListeners(Response.Listener overrideListener)

Requests to update the response listener, eventually using the given override response listener, that must be notified instead of the first exchange response listeners. This works in conjunction with getResponseListeners(), returning the appropriate response listeners that needs to be notified of response events.

Parameters
overrideListener:Response.Listener

the override response listener