Package org.eclipse.jetty.util.component
Interface Container
- All Known Subinterfaces:
Connector,NetworkConnector
- All Known Implementing Classes:
AbstractConnectionFactory,AbstractConnectionPool,AbstractConnector,AbstractConnectorHttpClientTransport,AbstractHandler,AbstractHandler,AbstractHandler,AbstractHandler.ErrorDispatchHandler,AbstractHandler.ErrorDispatchHandler,AbstractHandlerContainer,AbstractHandlerContainer,AbstractHandlerContainer,AbstractHTTP2ServerConnectionFactory,AbstractHTTP3ServerConnectionFactory,AbstractHttpClientTransport,AbstractLoginService,AbstractNetworkConnector,AbstractQuicheServerConnectionFactory,AbstractSession,AbstractSessionCache,AbstractSessionDataStore,AbstractSessionManager,AdaptiveExecutionStrategy,ALPNServerConnectionFactory,AsyncDelayHandler,AsyncDelayHandler,AttributeContainerMap,BrotliCompression,BufferedResponseHandler,BufferedResponseHandler,BufferedResponseHandler,CachingSessionDataStore,ClientConnectionFactory.Info,ClientConnectionFactoryOverHTTP2,ClientConnectionFactoryOverHTTP2.HTTP2,ClientConnectionFactoryOverHTTP3,ClientConnectionFactoryOverHTTP3.HTTP3,ClientConnector,ClientConnector.ClientSelectorManager,ClientProtocolSession,ClientQuicConfiguration,Compression,CompressionContentDecoderFactory,CompressionHandler,CompressionPool,ConditionalHandler,ConditionalHandler.Abstract,ConditionalHandler.DontHandle,ConditionalHandler.ElseNext,ConditionalHandler.NextElseReject,ConditionalHandler.Reject,ConditionalHandler.SkipNext,ConnectHandler,ConnectHandler.ConnectManager,ConstraintSecurityHandler,ConstraintSecurityHandler,ConstraintSecurityHandler,ConstraintSecurityHandler,ContainerLifeCycle,ContentDecoder.Factories,ContentDecoder.Factory,ContextHandler,ContextHandler,ContextHandler,ContextHandler.CoreContextHandler,ContextHandler.CoreContextHandler,ContextHandlerCollection,CoreAppContext,CrossOriginHandler,CustomRequestLog,DatagramServerConnector,DataSourceLoginService,DebugHandler,DebugHandler,DebugHandler,DefaultHandler,DefaultSessionCache,DefaultSessionIdManager,DeflaterPool,DelayedHandler,DelegatingThreadPool,DeploymentScanner,DetectorConnectionFactory,DoSHandler,DoSHandler.DelayedRejectHandler,DumpHandler,DuplexConnectionPool,EagerContentHandler,EagerFormHandler,EagerFormHandler,EchoHandler,EchoHandler.Buffered,EchoHandler.BufferedAsync,EchoHandler.Reactive,EchoHandler.Stream,ErrorHandler,ErrorHandler,ErrorPageErrorHandler,ErrorPageErrorHandler,EventsHandler,ExecutorThreadPool,FastCGIProxyHandler,FileBufferedResponseHandler,FileBufferedResponseHandler,FileSessionDataStore,GracefulHandler,GzipCompression,GzipHandler,Handler.Abstract,Handler.Abstract.NonBlocking,Handler.AbstractContainer,Handler.Sequence,Handler.Wrapper,HandlerCollection,HandlerCollection,HandlerList,HandlerList,HandlerWrapper,HandlerWrapper,HashLoginService,HazelcastSessionDataStore,HotSwapHandler,HotSwapHandler,HotSwapHandler,HTTP2Client,HTTP2CServerConnectionFactory,HTTP2ServerConnectionFactory,HTTP3Client,HTTP3ServerConnectionFactory,HTTP3Session,HTTP3SessionClient,HttpClient,HttpClientConnectionFactory.HTTP11,HttpClientTransportDynamic,HttpClientTransportOverFCGI,HttpClientTransportOverHTTP,HttpClientTransportOverHTTP2,HttpClientTransportOverHTTP3,HttpConnectionFactory,HttpDestination,HttpSpiContextHandler,IdleTimeoutHandler,IdleTimeoutHandler,IdleTimeoutHandler,InetAccessHandler,InetAccessHandler,InetAccessHandler,InflaterPool,JAASLoginService,JakartaWebSocketClientContainer,JakartaWebSocketClientContainer,JakartaWebSocketClientContainer,JakartaWebSocketContainer,JakartaWebSocketContainer,JakartaWebSocketContainer,JakartaWebSocketServerContainer,JakartaWebSocketServerContainer,JakartaWebSocketServerContainer,JakartaWebSocketShutdownContainer,JakartaWebSocketShutdownContainer,JakartaWebSocketShutdownContainer,JavaxWebSocketClientContainer,JavaxWebSocketContainer,JavaxWebSocketServerContainer,JavaxWebSocketShutdownContainer,JDBCLoginService,JDBCSessionDataStore,JettyWebSocketFrameHandlerFactory,JettyWebSocketFrameHandlerFactory,JettyWebSocketFrameHandlerFactory,JettyWebSocketServerContainer,JettyWebSocketServerContainer,JettyWebSocketServerContainer,JettyWebSocketServerContainer,KeyStoreScanner,LatencyRecordingHandler,LocalConnector,LowResourceMonitor,ManagedSelector,MemoryConnector,MongoSessionDataStore,MonitoredQueuedThreadPool,MovedContextHandler,MultiplexConnectionPool,NegotiatingServerConnectionFactory,NetworkTrafficServerConnector,NoSqlSessionDataStore,NullSessionCache,NullSessionDataStore,ObjectStreamSessionDataStore,OpenIdConfiguration,OpenIdLoginService,OptionalSslConnectionFactory,PathMappingsHandler,PathMappingsHandler.NoContext,PropertyUserStore,ProtocolSession,ProxyConnectionFactory,ProxyHandler,ProxyHandler.Forward,ProxyHandler.Reverse,QoSHandler,QueuedThreadPool,QuicConfiguration,QuicheClientQuicConfiguration,QuicheServerConnectionFactory,QuicheServerConnector,QuicheServerQuicConfiguration,QuicheSession,RandomConnectionPool,RawHTTP2ServerConnectionFactory,RawHTTP3ServerConnectionFactory,ReservedThreadExecutor,ResourceHandler,ResourceHandler,ResourceHandler,ResourceHandler.ResourceContext,RewriteHandler,RoundRobinConnectionPool,Scanner,ScopedHandler,ScopedHandler,SecuredRedirectHandler,SecuredRedirectHandler,SecuredRedirectHandler,SecurityHandler,SecurityHandler,SecurityHandler,SecurityHandler.PathMapped,SecurityHandler.PathMethodMapped,SelectorManager,Server,ServerConnector,ServerConnector.ServerConnectorManager,ServerFCGIConnectionFactory,ServerProtocolSession,ServerQuicConfiguration,ServerWebSocketContainer,ServletContextHandler,ServletContextHandler,ServletContextHandler,ServletContextHandler,ServletContextHandler.ServletContainerInitializerStarter,ServletContextHandler.ServletContainerInitializerStarter,ServletContextHandler.ServletContainerInitializerStarter,ServletContextHandler.ServletContainerInitializerStarter,ServletHandler,ServletHandler,ServletHandler,ServletHandler,ServletTester,ServletTester,ServletTester,ServletTester,SessionHandler,SessionHandler,SessionHandler,SessionHandler,SessionHandler,ShutdownHandler,SizeLimitHandler,SizeLimitHandler,SPNEGOLoginService,SslConnectionFactory,SslContextFactory,SslContextFactory.Client,SslContextFactory.Server,StandardDeployer,StateTrackingHandler,StaticAppContext,StatisticsHandler,StatisticsHandler.MinimumDataRateHandler,ThreadLimitHandler,ThreadLimitHandler,ThreadLimitHandler,TryPathsHandler,UnixDomainServerConnector,UnixDomainServerConnector.UnixDomainSelectorManager,UserStore,ValidatingConnectionPool,VirtualThreadPool,WebAppContext,WebAppContext,WebAppContext,WebAppContext,WebSocketClient,WebSocketClient,WebSocketClient,WebSocketComponents,WebSocketCoreClient,WebSocketServerComponents,WebSocketUpgradeHandler,WebSocketUpgradeHandler,ZstandardCompression
public interface Container
A Container
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceInherited Listener.static interfaceA listener for Container events. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd a bean.booleanAdds the given bean, explicitly managing it or not.static booleanA utility method to add a bean to a container.static booleanA utility method to add a bean to a container.booleanaddEventListener(EventListener listener) Add an event listener.<T> TgetBeans()<T> Collection<T>default <T> Collection<T>getCachedBeans(Class<T> clazz) <T> Collection<T>getContainedBeans(Class<T> clazz) default List<EventListener>Get the beans added to the container that are EventListeners.booleanTest if this container manages a beanvoidManages a bean already contained by this aggregate, so that it is started/stopped/destroyed with this aggregate.booleanremoveBean(Object o) Removes the given bean.static booleanremoveBean(Object parent, Object child) A utility method to remove a bean from a container.booleanremoveEventListener(EventListener listener) Remove an event listener.voidUnmanages a bean already contained by this aggregate, so that it is not started/stopped/destroyed with this aggregate.static voidA utility method to unmanage a bean from a container.
-
Method Details
-
addBean
Add a bean. If the bean is-aEventListener, then also do an implicitaddEventListener(EventListener).- Parameters:
o- the bean object to add- Returns:
- true if the bean was added, false if it was already present
-
addBean
Adds the given bean, explicitly managing it or not. If the bean is-aEventListener, then also do an implicitaddEventListener(EventListener).- Parameters:
o- The bean object to addmanaged- whether to managed the lifecycle of the bean- Returns:
- true if the bean was added, false if it was already present
-
getBeans
Collection<Object> getBeans()- Returns:
- the collection of beans known to this aggregate, in the order they were added.
-
getBeans
- Type Parameters:
T- the Bean type- Parameters:
clazz- the class of the beans- Returns:
- a list of beans of the given class (or subclass), in the order they were added.
- See Also:
-
getCachedBeans
- Type Parameters:
T- the Bean type- Parameters:
clazz- the class of the beans- Returns:
- a list of beans of the given class (or subclass), which may be cached/shared.
- See Also:
-
getBean
- Type Parameters:
T- the Bean type- Parameters:
clazz- the class of the bean- Returns:
- the first bean (in order added) of a specific class (or subclass), or null if no such bean exist
-
removeBean
Removes the given bean. If the bean is-aEventListener, then also do an implicitremoveEventListener(EventListener).- Parameters:
o- the bean to remove- Returns:
- whether the bean was removed
-
addEventListener
Add an event listener. EventListeners added by this method are also added as beans.- Parameters:
listener- the listener to add- Returns:
- true if the listener was added
- See Also:
-
removeEventListener
Remove an event listener.- Parameters:
listener- the listener to remove- Returns:
- true if the listener was removed
- See Also:
-
unmanage
Unmanages a bean already contained by this aggregate, so that it is not started/stopped/destroyed with this aggregate.- Parameters:
bean- The bean to unmanage (must already have been added).
-
manage
Manages a bean already contained by this aggregate, so that it is started/stopped/destroyed with this aggregate.- Parameters:
bean- The bean to manage (must already have been added).
-
isManaged
Test if this container manages a bean- Parameters:
bean- the bean to test- Returns:
- whether this aggregate contains and manages the bean
-
getContainedBeans
- Type Parameters:
T- the bean type- Parameters:
clazz- the class of the beans- Returns:
- the collection of beans of the given class from the
Containerhierarchy
-
getEventListeners
Get the beans added to the container that are EventListeners. This is essentially equivalent togetBeans(EventListener.class), except that:- The result may be precomputed, so it can be more efficient
- The result is ordered by the order added.
- The result is immutable.
- Returns:
- An unmodifiable list of EventListener beans
- See Also:
-
addBean
A utility method to add a bean to a container.- Parameters:
parent- the parent container.child- the child bean.- Returns:
- true if the child was added as a bean, false if parent was not instance of
Containeror bean was already present.
-
addBean
A utility method to add a bean to a container.- Parameters:
parent- the parent container.child- the child bean.managed- whether to managed the lifecycle of the bean.- Returns:
- true if the child was added as a bean, false if parent was not instance of
Containeror bean was already present.
-
unmanage
A utility method to unmanage a bean from a container.- Parameters:
parent- the parent containerchild- the child bean
-
removeBean
A utility method to remove a bean from a container.- Parameters:
parent- the parent container.child- the child bean.- Returns:
- true if parent was an instance of
Containerand the bean was removed.
-