Package com.iizix.server.prop
Class WebServerPortConfig
- java.lang.Object
- com.iizix.prop.GProp<GProp<?>[]>
- com.iizix.prop.PropCnr
- com.iizix.server.prop.WebServerPortConfig
- All Implemented Interfaces:
EventListener
,IGProp<GProp<?>[]>
,IPropCnr
,IWebServerPortConfig
,java.lang.Cloneable
- Direct Known Subclasses:
EditorWebServerPortConfig
public class WebServerPortConfig extends PropCnr implements IWebServerPortConfig
Property container for the configuration of a Port "group" of the web server. A port group is defines a bind address for a single or a range of ports to use, and the protocol to bind to (HTTP or HTTPS).
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BIND_ADDRESS
The protocol to use (HTTP or HTTPS).static java.lang.String
DEFAULT_PASSWORD
The default password used for keystores, Let's Encrypt certificates, etc: "changeit".static java.lang.String
DOMAIN_NAMES
Domain names.static java.lang.String
EXCLUDE_TLS_VERSION
Protocols to exclude: 0 = none, 1 = TLSv1.0, 2 = TLSv1.0 + 1.1.static java.lang.String
FRONT_END_SECURED
If the port is secure by means of a front-end proxy, even if the server protocol uses HTTP.static java.lang.String
ID_PASSWORD
The PKCS#12 identity password.static java.lang.String
ID_PKCS12
The PKCS#12 identity.static java.lang.String
LETS_ENCRYPT_DOMAINS
Domain names associated with Let's Encrypt, comma separated list.static java.lang.String
PORT_END
The name of the port end value.static java.lang.String
PORT_START
The name of the port start value.static java.lang.String
PROTOCOL
The protocol to use (HTTP or HTTPS).Fields inherited from class com.iizix.prop.PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_ID
Fields inherited from class com.iizix.prop.GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2
Fields inherited from interface com.iizix.prop.IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
Constructor Summary
Constructors Constructor Description WebServerPortConfig()
Creates the port configuration without a name.WebServerPortConfig(Atom atom)
Creates the port configuration with a name.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebServerPortConfig
clone()
Creates a clone out of this property.java.lang.String
getBindAddress()
Gets the bind address.IPortController
getController()
Gets the Jetty port controller.java.lang.String
getDescription()
Gets the description of the port configuration.java.lang.String
getDomainNames()
Gets the Let's Encrypt domain name associated with this port configuration.java.util.Set<java.lang.String>
getDomainNamesSet()
Gets the different domain names as String set.java.lang.String[]
getExcludedSecureProtocols()
Gets the excluded secure protocols.java.security.KeyStore
getKeyStore()
Gets the KeyStore from a PKCS#12 identity property and password.java.security.KeyStore
getKeyStore(java.lang.StringBuilder pwReturn)
Gets the KeyStore from a PKCS#12 identity property and password.java.lang.String
getKeyStorePassword()
Gets the KeyStore password.LetsEncryptDomain
getLetsEncryptDomain(java.lang.String domain)
Gets the Let's Encrypt domain instance for a specific domain name.java.lang.String
getLetsEncryptDomainNames()
Gets the Let's Encrypt domain name(s) associated with this port configuration.java.util.Set<java.lang.String>
getLetsEncryptDomainNamesSet()
Gets a new set of Let's Encrypt domain name(s) associated with this port configuration.LetsEncryptDomain[]
getLetsEncryptDomains()
Gets the Let's Encrypt domain instances associated with this port configuration.java.lang.String
getPortDescription()
Gets the description of the port configuration.int
getPortEnd()
Gets the port end in a range.int
getPortStart()
Gets the port start in a range.<T> T
getProperty(java.lang.String name, java.lang.Class<T> propClass)
Gets a runtime property based on a HashMap.int
getProtocol()
Gets the protocol to use.java.lang.String
getType()
Gets the type of port: HTTP or HTTPS.boolean
isFrontEndSecured()
Returns if the connection is secure by means of a front-end proxy, load balancer, etc.boolean
isHTTP()
Returns true if it's an unsecured HTTP port.boolean
isHTTPS()
Returns true if it's a secure HTTPS protocol port.void
restartConnector()
Restarts the Jetty (HTTPS) server connector after Let's Encrypt domain certificate renewal.void
setConfig(PortConfig config)
Sets the Jetty server connector configuration used with this configuration.<T> T
setProperty(java.lang.String name, T property, java.lang.Class<T> propClass)
Sets a runtime property based on a HashMap.Methods inherited from class com.iizix.prop.PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, doVirtualizePropCnr, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getReferences, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isSibling, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropDispose, onPropRemoved, onPropTreeInitialized, onReferenceEvent, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTree, virtualize
Methods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, extendsClone, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParent, getTreeLock, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onRemoteEvent, onVirtualizationCompleted, onVirtualized, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, verifyHasPropertyItem, warning, warning, warning
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.prop.IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, onRemoteEvent, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, verifyHasPropertyItem, warning, warning, warning
Methods inherited from interface com.iizix.prop.IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Field Detail
PORT_START
public static final java.lang.String PORT_START
The name of the port start value.- See Also:
- Constant Field Values
PORT_END
public static final java.lang.String PORT_END
The name of the port end value.- See Also:
- Constant Field Values
PROTOCOL
public static final java.lang.String PROTOCOL
The protocol to use (HTTP or HTTPS).- See Also:
- Constant Field Values
BIND_ADDRESS
public static final java.lang.String BIND_ADDRESS
The protocol to use (HTTP or HTTPS).- See Also:
- Constant Field Values
FRONT_END_SECURED
public static final java.lang.String FRONT_END_SECURED
If the port is secure by means of a front-end proxy, even if the server protocol uses HTTP.- See Also:
- Constant Field Values
ID_PKCS12
public static final java.lang.String ID_PKCS12
The PKCS#12 identity.- See Also:
- Constant Field Values
ID_PASSWORD
public static final java.lang.String ID_PASSWORD
The PKCS#12 identity password.- See Also:
- Constant Field Values
DOMAIN_NAMES
public static final java.lang.String DOMAIN_NAMES
Domain names.- See Also:
- Constant Field Values
LETS_ENCRYPT_DOMAINS
public static final java.lang.String LETS_ENCRYPT_DOMAINS
Domain names associated with Let's Encrypt, comma separated list.- See Also:
- Constant Field Values
DEFAULT_PASSWORD
public static final java.lang.String DEFAULT_PASSWORD
The default password used for keystores, Let's Encrypt certificates, etc: "changeit".- See Also:
- Constant Field Values
EXCLUDE_TLS_VERSION
public static final java.lang.String EXCLUDE_TLS_VERSION
Protocols to exclude: 0 = none, 1 = TLSv1.0, 2 = TLSv1.0 + 1.1.- See Also:
- Constant Field Values
Constructor Detail
WebServerPortConfig
public WebServerPortConfig()
Creates the port configuration without a name. The name must be set in all cases using thesetPropertyAtom
call.
WebServerPortConfig
public WebServerPortConfig(Atom atom)
Creates the port configuration with a name.- Parameters:
atom
- The name of the property.
Method Detail
getType
public java.lang.String getType()
Gets the type of port: HTTP or HTTPS.- Specified by:
getType
in interfaceIWebServerPortConfig
- Returns:
- The type string, or "Undefined" if undefined.
isHTTPS
public boolean isHTTPS()
Returns true if it's a secure HTTPS protocol port.- Returns:
- true if HTTPS is used for the port, false if HTTP.
isHTTP
public boolean isHTTP()
Returns true if it's an unsecured HTTP port.- Returns:
- true if HTTP is used for the port, false if HTTPS.
isFrontEndSecured
public boolean isFrontEndSecured()
Returns if the connection is secure by means of a front-end proxy, load balancer, etc. This means that the protocol can be HTTP but still be secure.- Specified by:
isFrontEndSecured
in interfaceIWebServerPortConfig
- Returns:
- true if secure and HTTPS is used by the client side, false otherwise.
getDescription
public java.lang.String getDescription()
Gets the description of the port configuration.- Specified by:
getDescription
in interfaceIWebServerPortConfig
- Returns:
- The description, "ports NN to MM, PROTOCOL" or "port NN, PROTOCOL" if not defined.
getPortDescription
public java.lang.String getPortDescription()
Gets the description of the port configuration.- Specified by:
getPortDescription
in interfaceIWebServerPortConfig
- Returns:
- The description, "ports NN to MM, PROTOCOL" or "port NN, PROTOCOL" if not defined.
clone
public WebServerPortConfig clone()
Creates a clone out of this property. The cloning is overridden by the subclasses in order to handle cloning of its class variables appropriately.
getPortStart
public int getPortStart()
Gets the port start in a range.- Specified by:
getPortStart
in interfaceIWebServerPortConfig
- Returns:
- The port start, or -1 if not defined.
getPortEnd
public int getPortEnd()
Gets the port end in a range.- Specified by:
getPortEnd
in interfaceIWebServerPortConfig
- Returns:
- The port end, or "getPortStart()" value if not defined.
getProtocol
public int getProtocol()
Gets the protocol to use.- Specified by:
getProtocol
in interfaceIWebServerPortConfig
- Returns:
- The protocol: 0=HTTP, 1=HTTPS, or -1 if not defined.
getBindAddress
public java.lang.String getBindAddress()
Gets the bind address.- Specified by:
getBindAddress
in interfaceIWebServerPortConfig
- Returns:
- The bind address, or null if not defined (never empty string).
getKeyStorePassword
public java.lang.String getKeyStorePassword()
Gets the KeyStore password.- Specified by:
getKeyStorePassword
in interfaceIWebServerPortConfig
- Returns:
- The password, null for none.
getKeyStore
public java.security.KeyStore getKeyStore() throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.io.IOException, java.security.UnrecoverableEntryException
Gets the KeyStore from a PKCS#12 identity property and password.- Specified by:
getKeyStore
in interfaceIWebServerPortConfig
- Returns:
- The configured KeyStore, or null if not defined.
- Throws:
java.security.KeyStoreException
- If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.java.security.NoSuchAlgorithmException
- If the algorithm used to check the integrity of the KeyStore cannot be found.java.security.cert.CertificateException
- If any of the certificates in the KeyStore could not be loaded or the Let's Encrypt domain was not found and this configuration is associated with Let's Encrypt.java.io.IOException
- If there is an I/O or format problem with the KeyStore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.java.security.UnrecoverableEntryException
- For errors in keystore.
getKeyStore
public java.security.KeyStore getKeyStore(java.lang.StringBuilder pwReturn) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.io.IOException, java.security.UnrecoverableEntryException
Gets the KeyStore from a PKCS#12 identity property and password. If the configuration is associated with a Let's Encrypt domain- Specified by:
getKeyStore
in interfaceIWebServerPortConfig
- Parameters:
pwReturn
- A StringBuilder instance that is filled with the password, null for none.- Returns:
- The configured KeyStore, or null if not defined.
- Throws:
java.security.KeyStoreException
- If no Provider supports a KeyStoreSpi implementation for the PKCS#12 type.java.security.NoSuchAlgorithmException
- If the algorithm used to check the integrity of the KeyStore cannot be found.java.security.cert.CertificateException
- If any of the certificates in the KeyStore could not be loaded or the Let's Encrypt domain was not found and this configuration is associated with Let's Encrypt.java.io.IOException
- If there is an I/O or format problem with the KeyStore data, if a password is required but not given, or if the given password was incorrect. If the error is due to a wrong password, the cause of the IOException should be an UnrecoverableKeyException.java.security.UnrecoverableEntryException
- For errors in keystore.
setProperty
public <T> T setProperty(java.lang.String name, T property, java.lang.Class<T> propClass) throws java.lang.ClassCastException
Sets a runtime property based on a HashMap.- Specified by:
setProperty
in interfaceIWebServerPortConfig
- Parameters:
name
- The property name.property
- The property, or null to remove it.propClass
- The class of the property to return if replaced.- Returns:
- The previous property, null for none.
- Throws:
java.lang.ClassCastException
- If the object is not null and is not assignable to the type T.
getProperty
public <T> T getProperty(java.lang.String name, java.lang.Class<T> propClass) throws java.lang.ClassCastException
Gets a runtime property based on a HashMap.- Specified by:
getProperty
in interfaceIWebServerPortConfig
- Parameters:
name
- The property name.propClass
- The class of the property to return if replaced.- Returns:
- The property, null if not previously set.
- Throws:
java.lang.ClassCastException
- If the object is not null and is not assignable to the type T.
getDomainNames
public java.lang.String getDomainNames()
Gets the Let's Encrypt domain name associated with this port configuration.- Returns:
- The domain name as e.g. "hello.example.com", or null if not associated with Let's Encrypt.
getDomainNamesSet
public java.util.Set<java.lang.String> getDomainNamesSet()
Gets the different domain names as String set. The domains names set includes all defined domain names that are configured for this port.- Returns:
- A new set of domain names.
getLetsEncryptDomainNames
public java.lang.String getLetsEncryptDomainNames()
Gets the Let's Encrypt domain name(s) associated with this port configuration.- Specified by:
getLetsEncryptDomainNames
in interfaceIWebServerPortConfig
- Returns:
- The domain name(s) as e.g. "hello.example.com", or null if not associated with Let's Encrypt.
getLetsEncryptDomainNamesSet
public java.util.Set<java.lang.String> getLetsEncryptDomainNamesSet()
Gets a new set of Let's Encrypt domain name(s) associated with this port configuration.- Specified by:
getLetsEncryptDomainNamesSet
in interfaceIWebServerPortConfig
- Returns:
- The domain name(s) as e.g. "hello.example.com", or empty list if not associated with Let's Encrypt.
getLetsEncryptDomains
public LetsEncryptDomain[] getLetsEncryptDomains()
Gets the Let's Encrypt domain instances associated with this port configuration.- Returns:
- The domain instance that are configured and found.
getLetsEncryptDomain
public LetsEncryptDomain getLetsEncryptDomain(java.lang.String domain)
Gets the Let's Encrypt domain instance for a specific domain name.- Parameters:
domain
- The domain name.- Returns:
- The Let's encrypt domain for that name, null if not found.
setConfig
public void setConfig(PortConfig config)
Sets the Jetty server connector configuration used with this configuration.- Specified by:
setConfig
in interfaceIWebServerPortConfig
- Parameters:
config
- The configuration instance.
restartConnector
public void restartConnector()
Restarts the Jetty (HTTPS) server connector after Let's Encrypt domain certificate renewal.
getController
public IPortController getController()
Gets the Jetty port controller.- Returns:
- The port controller, or null if not initialized.
getExcludedSecureProtocols
public java.lang.String[] getExcludedSecureProtocols()
Gets the excluded secure protocols.- Specified by:
getExcludedSecureProtocols
in interfaceIWebServerPortConfig
- Returns:
- Empty string for none, otherwise e.g. "TLSv1", "TLSv1.1".