Class ServerAddress

java.lang.Object
de.iip_ecosphere.platform.support.ServerAddress
All Implemented Interfaces:
Serializable

public class ServerAddress extends Object implements Serializable
Represents a reusable server address.
Author:
Holger Eichelberger, SSE
See Also:
  • Field Details

  • Constructor Details

    • ServerAddress

      public ServerAddress(Schema schema)
      Creates a new LOCALHOST server address instance on an ephemerial port.
      Parameters:
      schema - the schema
    • ServerAddress

      public ServerAddress(Schema schema, int port)
      Creates a new LOCALHOST server address instance.
      Parameters:
      schema - the schema
      port - the port number (ignored if negative)
    • ServerAddress

      public ServerAddress(Schema schema, String host, int port)
      Creates a new server address instance.
      Parameters:
      schema - the schema
      host - the hostname (turned to LOCALHOST if null or empty)
      port - the port number
  • Method Details

    • getSchema

      public Schema getSchema()
      Returns the schema.
      Returns:
      the schema
    • getHost

      public String getHost()
      Returns the host name.
      Returns:
      the host name
    • getPort

      public int getPort()
      Returns the port number.
      Returns:
      the port number
    • toUri

      public String toUri()
      Returns the URI representation of this server address. Intended to be overridden by subclasses.
      Returns:
      the URI representation
    • toServerUri

      public final String toServerUri()
      Returns the URI representation of the server address apart from overridden extensions in toUri().
      Returns:
      the URI representation of the server address
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • validatePort

      public static int validatePort(int port)
      Validates port and if port is not valid, turn it into an ephemeral port.
      Parameters:
      port - the port to validate
      Returns:
      the validated port, i.e., port or an ephemeral port number
      See Also:
    • isValidPort

      public static boolean isValidPort(int port)
      Returns whether port is a valid port number.
      Parameters:
      port - the port number
      Returns:
      true for valid, false else