Top Description Fields Constructors Methods
org.glassfish.tyrus.container.jdk.client

pack-priv Class Filter

extends Object
Class Inheritance
Known Direct Subclasses
org.glassfish.tyrus.container.jdk.client.SslFilter, org.glassfish.tyrus.container.jdk.client.TaskQueueFilter, org.glassfish.tyrus.container.jdk.client.TransportFilter, org.glassfish.tyrus.container.jdk.client.ClientFilter
Imports
java.net.SocketAddress, java.nio.ByteBuffer, org.glassfish.tyrus.spi.CompletionHandler

A filter can add functionality to JDK client transport. Filters are composed together to create JDK client transport.
Authors
Petr Janouch, Pavel Bucek

Field Summary

Modifier and TypeField and Description
protected final Filter
protected volatile Filter

Constructor Summary

AccessConstructor and Description
pack-priv
Filter(Filter
downstream filter. Accessible directly as downstreamFilter protected field.
downstreamFilter
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
close()

Close the filter, invokes close operation on the next filter in the filter chain.

pack-priv final void
connect(SocketAddress
an address where to connect (server or proxy).
address
,
Filter
a filter positioned upstream.
upstreamFilter
)

Initiate connect.

pack-priv void
handleConnect(SocketAddress
an address where to connect (server or proxy).
address
,
Filter
a filter positioned upstream.
upstreamFilter
)

Handle connect(SocketAddress, Filter).

pack-priv final void
onConnect()

An event listener that is called when a connection is set up.

pack-priv final void
onConnectionClosed()

An event listener that is called when the connection is closed by the peer.

pack-priv final void
onError(Throwable
an error that has occurred.
t
)

An event listener that is called when an error has occurred.

pack-priv final void
onRead(ByteBuffer
that has been read.
data
)

An event listener that is called when some data is read.

pack-priv final void
onSslHandshakeCompleted()

An event listener that is called, when SSL completes its handshake.

pack-priv void
pack-priv void
pack-priv void
processError(Throwable
an error that has occurred.
t
)

Process onError(Throwable).

pack-priv boolean

Returns:

true if the data should be sent to processing to upper filter in the chain, false otherwise.
processRead
(ByteBuffer
read data.
data
)

Process onRead(ByteBuffer).

pack-priv void
pack-priv void
startSsl()

Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.

pack-priv void
write(ByteBuffer
on which write operation is performed.
data
,
CompletionHandler<ByteBuffer>
will be invoked when the write operation is completed or has failed.
completionHandler
)

Perform write operation for this filter and invokes write method on the next filter in the filter chain.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

downstreamFilterback to summary
protected final Filter downstreamFilter
upstreamFilterback to summary
protected volatile Filter upstreamFilter

Constructor Detail

Filterback to summary
pack-priv Filter(Filter downstreamFilter)

Constructor.

Parameters
downstreamFilter:Filter

downstream filter. Accessible directly as downstreamFilter protected field.

Method Detail

closeback to summary
pack-priv void close()

Close the filter, invokes close operation on the next filter in the filter chain.

The filter is expected to clean up any allocated resources and pass the invocation to downstream filter.

connectback to summary
pack-priv final void connect(SocketAddress address, Filter upstreamFilter)

Initiate connect.

If the Filter needs to do something during this phase, it must implement handleConnect(SocketAddress, Filter) method.

Parameters
address:SocketAddress

an address where to connect (server or proxy).

upstreamFilter:Filter

a filter positioned upstream.

handleConnectback to summary
pack-priv void handleConnect(SocketAddress address, Filter upstreamFilter)

Handle connect(SocketAddress, Filter).

Parameters
address:SocketAddress

an address where to connect (server or proxy).

upstreamFilter:Filter

a filter positioned upstream.

See Also
connect(SocketAddress, Filter)
onConnectback to summary
pack-priv final void onConnect()

An event listener that is called when a connection is set up. This event travels up in the filter chain.

If the Filter needs to process this event, it must implement processConnect() method.

onConnectionClosedback to summary
pack-priv final void onConnectionClosed()

An event listener that is called when the connection is closed by the peer.

If the Filter needs to process this event, it must implement processConnectionClosed() method.

onErrorback to summary
pack-priv final void onError(Throwable t)

An event listener that is called when an error has occurred.

Errors travel in direction from downstream filter to upstream filter.

If the Filter needs to process this event, it must implement processError(Throwable) method.

Parameters
t:Throwable

an error that has occurred.

onReadback to summary
pack-priv final void onRead(ByteBuffer data)

An event listener that is called when some data is read.

If the Filter needs to process this event, it must implement processRead(ByteBuffer) ()} method. If the method returns true, the processing will continue with upstream filters; if the method invocation returns false, the processing won't continue.

Parameters
data:ByteBuffer

that has been read.

onSslHandshakeCompletedback to summary
pack-priv final void onSslHandshakeCompleted()

An event listener that is called, when SSL completes its handshake.

If the Filter needs to process this event, it must implement processSslHandshakeCompleted() method.

processConnectback to summary
pack-priv void processConnect()

Process onConnect().

See Also
onConnect()
processConnectionClosedback to summary
pack-priv void processConnectionClosed()

Process onConnectionClosed().

See Also
onConnectionClosed()
processErrorback to summary
pack-priv void processError(Throwable t)

Process onError(Throwable).

Parameters
t:Throwable

an error that has occurred.

See Also
onError(Throwable)
processReadback to summary
pack-priv boolean processRead(ByteBuffer data)

Process onRead(ByteBuffer).

Parameters
data:ByteBuffer

read data.

Returns:boolean

true if the data should be sent to processing to upper filter in the chain, false otherwise.

See Also
onRead(ByteBuffer)
processSslHandshakeCompletedback to summary
pack-priv void processSslHandshakeCompleted()

Process onSslHandshakeCompleted().

See Also
onSslHandshakeCompleted()
startSslback to summary
pack-priv void startSsl()

Signal to turn on SSL, it is passed on in the filter chain until a filter responsible for SSL is reached.

writeback to summary
pack-priv void write(ByteBuffer data, CompletionHandler<ByteBuffer> completionHandler)

Perform write operation for this filter and invokes write method on the next filter in the filter chain.

Parameters
data:ByteBuffer

on which write operation is performed.

completionHandler:CompletionHandler<ByteBuffer>

will be invoked when the write operation is completed or has failed.