Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.portunif

public Class PUFilter

extends BaseFilter
Class Inheritance
Imports
java.io.IOException, java.util.Set, java.util.concurrent.CancellationException, java.util.logging.Level, .Logger, org.glassfish.grizzly.CompletionHandler, .Connection, .Context, .Grizzly, .IOEvent, .IOEventLifeCycleListener, .ProcessorExecutor, org.glassfish.grizzly.attributes.Attribute, org.glassfish.grizzly.filterchain.BaseFilter, .Filter, .FilterChain, .FilterChainBuilder, .FilterChainContext, .FilterChainContext.CopyListener, .FilterChainEvent, .NextAction, org.glassfish.grizzly.utils.ArraySet

Port unification filter.
Author
Alexey Stashok

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private class
private class

Field Summary

Modifier and TypeField and Description
private final BackChannelFilter
private final boolean
private static final Logger
private final ArraySet<PUProtocol>
pack-priv final Attribute<PUContext>
pack-priv final Attribute<FilterChainContext>
private final PUFilter.SuspendedContextCopyListener

Constructor Summary

AccessConstructor and Description
public
public
PUFilter(final boolean
true if a Connection whose protocol is not recognized will be automatically closed, or false if normal FilterChain processing will be continued for such Connection, so a Filter next to PUFilter may implement custom logic to process unrecognized connection.
isCloseUnrecognizedConnection
)

Constructs PUFilter.

Method Summary

Modifier and TypeMethod and Description
public void
deregister(final PUProtocol puProtocol)

Deregisters the PUProtocol.

protected void
findProtocol(final PUContext puContext, final FilterChainContext ctx)

public Filter

Returns:

back channel Filter.
getBackChannelFilter
()

Get the back channel Filter implementation, which should connect the custom protocol FilterChain with the main FilterChain.

public Set<PUProtocol>

Returns:

PUProtocol Set.
getProtocols
()

Get registered port unification protocols - PUProtocols.

public FilterChainBuilder
getPUFilterChainBuilder()

Returns the FilterChainBuilder, developers may use to build there custom protocol filter chain.

public NextAction
handleClose(FilterChainContext ctx)

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleClose.

Implements org.glassfish.grizzly.filterchain.Filter.handleClose.

Execute a unit of processing work to be performed, when connection has been closed.

public NextAction
public NextAction
handleRead(final FilterChainContext ctx)

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleRead.

Implements org.glassfish.grizzly.filterchain.Filter.handleRead.

Execute a unit of processing work to be performed, when channel will become available for reading.

public boolean
isCloseUnrecognizedConnection()

Returns true if a Connection whose protocol is not recognized will be automatically closed, or false if normal FilterChain processing will be continued for such Connection, so a Filter next to PUFilter may implement custom logic to process unrecognized connection.

private static boolean
private FilterChainContext
obtainChildFilterChainContext(final PUProtocol protocol, final Connection<L> connection, final FilterChainContext ctx)

public PUProtocol

Returns:

PUProtocol, which wraps passed ProtocolFinder and FilterChain.
register
(final ProtocolFinder protocolFinder, final FilterChain filterChain)

Registers new ProtocolFinder - FilterChain pair, which defines the protocol.

public void
register(final PUProtocol puProtocol)

Registers new PUProtocol.

Inherited from org.glassfish.grizzly.filterchain.BaseFilter:
createContextexceptionOccurredhandleAccepthandleConnecthandleWriteonAddedonFilterChainChangedonRemovedtoString

Field Detail

backChannelFilterback to summary
private final BackChannelFilter backChannelFilter
isCloseUnrecognizedConnectionback to summary
private final boolean isCloseUnrecognizedConnection
LOGGERback to summary
private static final Logger LOGGER
protocolsback to summary
private final ArraySet<PUProtocol> protocols
puContextAttributeback to summary
pack-priv final Attribute<PUContext> puContextAttribute
suspendedContextAttributeback to summary
pack-priv final Attribute<FilterChainContext> suspendedContextAttribute
suspendedContextCopyListenerback to summary
private final PUFilter.SuspendedContextCopyListener suspendedContextCopyListener

Constructor Detail

PUFilterback to summary
public PUFilter()
PUFilterback to summary
public PUFilter(final boolean isCloseUnrecognizedConnection)

Constructs PUFilter.

Parameters
isCloseUnrecognizedConnection:boolean

true if a Connection whose protocol is not recognized will be automatically closed, or false if normal FilterChain processing will be continued for such Connection, so a Filter next to PUFilter may implement custom logic to process unrecognized connection.

Method Detail

deregisterback to summary
public void deregister(final PUProtocol puProtocol)

Deregisters the PUProtocol.

Parameters
puProtocol:PUProtocol

PUProtocol

findProtocolback to summary
protected void findProtocol(final PUContext puContext, final FilterChainContext ctx)
getBackChannelFilterback to summary
public Filter getBackChannelFilter()

Get the back channel Filter implementation, which should connect the custom protocol FilterChain with the main FilterChain. Usually developers shouldn't use this method, if they build custom protocol chains using getPUFilterChainBuilder(), otherwise they have to make sure there custom protocol FilterChain contains back channel Filter (usually first Filter in the custom protocol filter chain).

Returns:Filter

back channel Filter.

getProtocolsback to summary
public Set<PUProtocol> getProtocols()

Get registered port unification protocols - PUProtocols.

Returns:Set<PUProtocol>

PUProtocol Set.

getPUFilterChainBuilderback to summary
public FilterChainBuilder getPUFilterChainBuilder()

Returns the FilterChainBuilder, developers may use to build there custom protocol filter chain. The returned FilterChainBuilder may have some Filters pre-added.

Returns:FilterChainBuilder

FilterChainBuilder.

handleCloseback to summary
public NextAction handleClose(FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleClose.

Implements org.glassfish.grizzly.filterchain.Filter.handleClose.

Doc from org.glassfish.grizzly.filterchain.BaseFilter.handleClose.

Execute a unit of processing work to be performed, when connection has been closed. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Annotations
@Override
handleEventback to summary
public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleEvent.

Implements org.glassfish.grizzly.filterchain.Filter.handleEvent.

Doc from org.glassfish.grizzly.filterchain.BaseFilter.handleEvent.

Handle custom event associated with the Connection. This Filter may either complete the required processing and return StopAction, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning InvokeAction.

Annotations
@Override
handleReadback to summary
public NextAction handleRead(final FilterChainContext ctx) throws IOException

Overrides org.glassfish.grizzly.filterchain.BaseFilter.handleRead.

Implements org.glassfish.grizzly.filterchain.Filter.handleRead.

Doc from org.glassfish.grizzly.filterchain.BaseFilter.handleRead.

Execute a unit of processing work to be performed, when channel will become available for reading. This Filter may either complete the required processing and return false, or delegate remaining processing to the next Filter in a FilterChain containing this Filter by returning true.

Annotations
@Override
isCloseUnrecognizedConnectionback to summary
public boolean isCloseUnrecognizedConnection()

Returns true if a Connection whose protocol is not recognized will be automatically closed, or false if normal FilterChain processing will be continued for such Connection, so a Filter next to PUFilter may implement custom logic to process unrecognized connection.

isUpstreamback to summary
private static boolean isUpstream(final FilterChainContext context)
obtainChildFilterChainContextback to summary
private FilterChainContext obtainChildFilterChainContext(final PUProtocol protocol, final Connection<L> connection, final FilterChainContext ctx)
registerback to summary
public PUProtocol register(final ProtocolFinder protocolFinder, final FilterChain filterChain)

Registers new ProtocolFinder - FilterChain pair, which defines the protocol.

Parameters
protocolFinder:ProtocolFinder

ProtocolFinder

filterChain:FilterChain

FilterChain

Returns:PUProtocol

PUProtocol, which wraps passed ProtocolFinder and FilterChain.

registerback to summary
public void register(final PUProtocol puProtocol)

Registers new PUProtocol.

Parameters
puProtocol:PUProtocol

PUProtocol

org.glassfish.grizzly.portunif back to summary

private Class PUFilter.InternalCompletionHandler

extends Object
implements CompletionHandler<FilterChainContext>
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.portunif.PUFilter.InternalCompletionHandler
All Implemented Interfaces
org.glassfish.grizzly.CompletionHandler

Field Summary

Modifier and TypeField and Description
private final FilterChainContext

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
cancelled()

Implements org.glassfish.grizzly.CompletionHandler.cancelled.

The operation was cancelled.

public void
completed(final FilterChainContext context)

Implements org.glassfish.grizzly.CompletionHandler.completed.

The operation was completed.

public void
failed(final Throwable throwable)

Implements org.glassfish.grizzly.CompletionHandler.failed.

The operation was failed.

public void
updated(FilterChainContext result)

Implements org.glassfish.grizzly.CompletionHandler.updated.

The callback method may be called, when there is some progress in operation execution, but it is still not completed

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

suspendedContextback to summary
private final FilterChainContext suspendedContext

Constructor Detail

InternalCompletionHandlerback to summary
public InternalCompletionHandler(FilterChainContext suspendedContext)

Method Detail

cancelledback to summary
public void cancelled()

Implements org.glassfish.grizzly.CompletionHandler.cancelled.

Doc from org.glassfish.grizzly.CompletionHandler.cancelled.

The operation was cancelled.

Annotations
@Override
completedback to summary
public void completed(final FilterChainContext context)

Implements org.glassfish.grizzly.CompletionHandler.completed.

Doc from org.glassfish.grizzly.CompletionHandler.completed.

The operation was completed.

Annotations
@Override
failedback to summary
public void failed(final Throwable throwable)

Implements org.glassfish.grizzly.CompletionHandler.failed.

Doc from org.glassfish.grizzly.CompletionHandler.failed.

The operation was failed.

Annotations
@Override
updatedback to summary
public void updated(FilterChainContext result)

Implements org.glassfish.grizzly.CompletionHandler.updated.

Doc from org.glassfish.grizzly.CompletionHandler.updated.

The callback method may be called, when there is some progress in operation execution, but it is still not completed

Annotations
@Override
org.glassfish.grizzly.portunif back to summary

private Class PUFilter.InternalProcessingHandler

extends Adapter
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final FilterChainContext

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
public void
Inherited from org.glassfish.grizzly.IOEventLifeCycleListener.Adapter:
onContextManualIOEventControlonContextResumeonContextSuspendonErroronLeaveonNotRunonRerunonTerminate

Field Detail

parentContextback to summary
private final FilterChainContext parentContext

Constructor Detail

InternalProcessingHandlerback to summary
private InternalProcessingHandler(final FilterChainContext parentContext)

Method Detail

onCompleteback to summary
public void onComplete(final Context context, final Object data) throws IOException

Overrides org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onComplete.

Implements org.glassfish.grizzly.IOEventLifeCycleListener.onComplete.

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onComplete.

IOEvent processing completed.

Annotations
@Override
Exceptions
IOException:

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.onComplete.

on error

onReregisterback to summary
public void onReregister(final Context context) throws IOException

Overrides org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onReregister.

Implements org.glassfish.grizzly.IOEventLifeCycleListener.onReregister.

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.Adapter.onReregister.

Reregister IOEvent interest.

Annotations
@Override
Exceptions
IOException:

Doc from org.glassfish.grizzly.IOEventLifeCycleListener.onReregister.

on error

org.glassfish.grizzly.portunif back to summary

private Class PUFilter.SuspendedContextCopyListener

extends Object
implements CopyListener
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.portunif.PUFilter.SuspendedContextCopyListener
All Implemented Interfaces
org.glassfish.grizzly.filterchain.FilterChainContext.CopyListener

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
onCopy(final FilterChainContext srcContext, final FilterChainContext copiedContext)

Implements org.glassfish.grizzly.filterchain.FilterChainContext.CopyListener.onCopy.

The method is called, when passed FilterChainContext is copied.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SuspendedContextCopyListenerback to summary
private SuspendedContextCopyListener()

Method Detail

onCopyback to summary
public void onCopy(final FilterChainContext srcContext, final FilterChainContext copiedContext)

Implements org.glassfish.grizzly.filterchain.FilterChainContext.CopyListener.onCopy.

Doc from org.glassfish.grizzly.filterchain.FilterChainContext.CopyListener.onCopy.

The method is called, when passed FilterChainContext is copied.

Annotations
@Override