Package com.iizix.server
Interface IServer
- All Superinterfaces:
- IAppLoader
- All Known Implementing Classes:
- JakartaEEServer,- JettyRunConfiguration,- RuntimeBuilderServer,- ServerShell,- StandardServer
The interface to the Server instance, whether running in a JakartaEE Application Server or stand-alone using another web server and/or WebSocket implementation.
- Nested Class SummaryNested ClassesModifier and TypeInterfaceDescription- static enumError enum used when validating an App ID with locale support.- static enumStates of the server.
- Field SummaryFieldsModifier and TypeFieldDescription- static final intThe maximum valid length of an App ID in characters = 64.
- Method SummaryModifier and TypeMethodDescription- boolean- addDisposeListener- (IServerDisposeListener listener) Adds a server dispose.- addEndPointListener- (IEndPointListener listener) Adds a listener of end point create/dispose and retrieves the list of current end points.- boolean- addModule- (IServerModule<?> module) Adds a server module for processing.- boolean- dispose()Disposes of the server, e.g.Gets the default mail sender.Gets an array of all end points.- getMailSender- (String name) Gets the default mail sender.Gets the web server root directory.Gets the Server Properties.- getState()Gets the state of the server.The transaction processor coordinator.- voidCalled to load the application.- void- onEndPointDisposed- (IEndPoint endPoint) Called when an end point is disposed of.- voidProcesses server start-up asynchronously.- registerApplication- (String id, AppDefinition app) Registers an application with an ID available in the server.- boolean- registerRequestPrinter- (String target, IWebServerRequestPrinter processor) Registers a new request printer.- boolean- removeDisposeListener- (IServerDisposeListener listener) Removes a server dispose listener.- boolean- removeEndPointListener- (IEndPointListener listener) Adds a listener of end point create/dispose and retrieves the list of current end points.- boolean- removeModule- (IServerModule<?> module) Removes a server module for processing.- voidStarts the server synchronously.- boolean- unregisterRequestPrinter- (String target, IWebServerRequestPrinter processor) Unregister a previously registered request printer.- static IServer.InvalidAppID- validateAppID- (String id) Checks an App ID for validity.- Methods inherited from interface com.iizix.server.IAppLoader- getExecutorService, getPropertyManager, loadFile, loadFile, loadPlugins
- Field Details- MAX_VALID_APP_ID_LENGTHstatic final int MAX_VALID_APP_ID_LENGTHThe maximum valid length of an App ID in characters = 64.- See Also:
 
 
- Method Details- validateAppIDChecks an App ID for validity.- Valid App ID's are the characters A-Z, a-z, 0-9, and the characters - ._, where the first character must be A-Z or a-z. App ID's are case sensitive. The maximum length of an App ID is 64 characters.- Parameters:
- id- The application ID.
- Returns:
- The IServer.InvalidAppIDinstance of the error, ornullfor valid.
 
- addDisposeListenerAdds a server dispose. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
- listener- The listener to add.
- Returns:
- true if the listener was added, false otherwise.
- Throws:
- NullPointerException- If the listener is- null.
 
- removeDisposeListenerRemoves a server dispose listener.- Parameters:
- listener- The listener to remove.
- Returns:
- true if listener is successfully removed, false otherwise.
 
- startServerStarts the server synchronously.- Throws:
- Throwable- for start-up errors.
 
- onStartServerProcesses server start-up asynchronously.- Throws:
- Throwable- for start-up errors.
 
- loadApplicationsCalled to load the application.- Throws:
- Throwable- for start-up errors.
 
- registerApplicationAppDefinition registerApplication- (String id, AppDefinition app) throws ServerApplicationSetupException Registers an application with an ID available in the server.- Parameters:
- id- The ID of the application.
- app- The application.
- Returns:
- The previous overwritten application, or null for a new application.
- Throws:
- ServerApplicationSetupException- In case a plug-in fail to initialize.
 
- disposeboolean dispose()Disposes of the server, e.g. at shut-down. This dispose call will wait until the server has shut-down successfully.- Returns:
- true for success, false if already disposed of or stopping/disposing.
 
- getStateIServer.State getState()Gets the state of the server.- Returns:
- The server state: STARTING, STARTED, STOPPING or STOPPED.
 
- getServerPropertiesServerProps getServerProperties()Gets the Server Properties.
- getDefaultMailSenderMailSender getDefaultMailSender() throws NotFoundException, AddressException, NoSuchProviderException, IOExceptionGets the default mail sender.- Returns:
- The default mail sender.
- Throws:
- NotFoundException- If the mail sender is not found.
- IOException- If the mail queue directory does not exist.
- NoSuchProviderException- If the "smtp" or "smtps" providers do not exist!
- AddressException- If the default sender failed to parse.
 
- getMailSenderMailSender getMailSender- (String name) throws NotFoundException, AddressException, NoSuchProviderException, IOException Gets the default mail sender.- Parameters:
- name- The mail sender name, null for default or the first one found if no default is configured.
- Returns:
- The default mail sender.
- Throws:
- NotFoundException- If the mail sender is not found.
- IOException- If the mail queue directory does not exist.
- NoSuchProviderException- If the "smtp" or "smtps" providers do not exist!
- AddressException- If the default sender failed to parse.
 
- addModuleAdds a server module for processing. The module can have an end point constructor that is added during initialization.- Parameters:
- module- The server module.
- Returns:
- true for success, false if already added.
 
- removeModuleRemoves a server module for processing. This will unregister a potential end point constructor and dispose of the module.- Parameters:
- module- The server module.
- Returns:
- true for success, false if already removed.
 
- getEndPointsInstancesIEndPoint[] getEndPointsInstances()Gets an array of all end points. Avoid this method as it causes unnecessary garbage collection, use getEndPointsCollection instead.- Returns:
- an array of EndPoint instances.
 
- onEndPointDisposedCalled when an end point is disposed of.
- addEndPointListenerAdds a listener of end point create/dispose and retrieves the list of current end points. Calling this method several times with the same listener does not add a new one, it is similar to calling- getEndPointInstances().- Parameters:
- listener- The end point listener.
- Returns:
- An array of EndPoint instances.
 
- removeEndPointListenerAdds a listener of end point create/dispose and retrieves the list of current end points. Calling this method several times with the same listener does not add a new one, it is similar to calling- getEndPointInstances().- Parameters:
- listener- The end point listener.
- Returns:
- true for success, false if not added as listener.
 
- getTXPCoordinatorITXPCoordinator getTXPCoordinator()The transaction processor coordinator.
- getRootDirectoryString getRootDirectory()Gets the web server root directory.- Returns:
- The directory, or null if web server is not started.
 
- registerRequestPrinterRegisters a new request printer.- Parameters:
- target- The target URL, always starting with "/" and doesn't contain the query.
- processor- The print processor.
- Returns:
- true if added successfully, false if the print processor already exists or the server is not started yet.
 
- unregisterRequestPrinterUnregister a previously registered request printer.- Parameters:
- target- The target URL, always starting with "/" and doesn't contain the query.
- processor- The print processor.
- Returns:
- true if removed successfully, false if the print processor does not exist or doesn't match, or the server is not yet started.