Package org.kiwiproject.registry.util
Class Ports
- java.lang.Object
-
- org.kiwiproject.registry.util.Ports
-
public class Ports extends Object
Utility methods for finding a desired port out of a list of port definitions
-
-
Constructor Summary
Constructors Constructor Description Ports()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
determineScheme(List<Port> ports, Port.PortType type)
Determines the HTTP scheme to use for a given typestatic Port
findFirstPortPreferSecure(List<Port> ports, Port.PortType type)
Finds the first port of a given type (Application or Admin) from the list.static Port
findPort(List<Port> ports, Port.Security security, Port.PortType type)
Finds a desired port given a security and type criteria
-
-
-
Method Detail
-
findFirstPortPreferSecure
public static Port findFirstPortPreferSecure(List<Port> ports, Port.PortType type)
Finds the first port of a given type (Application or Admin) from the list. If multiple ports are found and at least one is marked secure, that port will be given priority. If multiple ports are found with the same security level, then the first one is returned.- Parameters:
ports
- The list of ports to traversetype
- The type of port that is being requested- Returns:
- The port definition that was found based on the given criteria
-
findPort
public static Port findPort(List<Port> ports, Port.Security security, Port.PortType type)
Finds a desired port given a security and type criteria- Parameters:
ports
- The list of ports to traversesecurity
- The security of the port that is desired (Secure or Non-Secure)type
- The type of port that is desired (Application or Admin)- Returns:
- The port definition that was found based on the given criteria
-
determineScheme
public static String determineScheme(List<Port> ports, Port.PortType type)
Determines the HTTP scheme to use for a given type- Parameters:
ports
- The list of ports to traverse to determine the schemetype
- The type of port that is desired (Application or Admin)- Returns:
- The scheme (https or http) based on the port definitions
- See Also:
findFirstPortPreferSecure(List, Port.PortType)
-
-