Class DestinationServer


  • public class DestinationServer
    extends java.lang.Object
    The destination server to contact. This class is not thread safe.
    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      DestinationServer​(java.lang.String hostName, int port, boolean isSecure, boolean isRedirectionAllowed)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanequals​(java.lang.Object obj)
      Checks if two destination server object are equal.
      java.lang.StringgetHostName()
      Gets the server host name.
      intgetPort()
      Gets the port of the server.
      inthashCode()
      Returns the hashCode.
      booleanisDefaultPort()
      Checks if it's the default port.
      booleanisRedirectionAllowed()
      Returns whether redirection to another server is allowed.
      booleanisSecure()
      Gets if SSL is used or not.
      java.lang.StringtoString()
      Creates a string representation of the instance.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DestinationServer

        public DestinationServer​(java.lang.String hostName,
                                 int port,
                                 boolean isSecure,
                                 boolean isRedirectionAllowed)
        Constructor.
        Parameters:
        hostName - The server host name.
        port - Port number, -1 for default (80 for non-secure, 443 for secure).
        isSecure - Flag for server secure.
        isRedirectionAllowed - Flag for redirection allowed.
        Throws:
        java.lang.NullPointerException - If hostName is null.
        java.lang.IllegalArgumentException - If port is not -1 or in range of 1-65535.
    • Method Detail

      • getHostName

        public java.lang.String getHostName()
        Gets the server host name.
        Returns:
        The host name.
      • isDefaultPort

        public boolean isDefaultPort()
        Checks if it's the default port.
        Returns:
        true if port is -1 or port is 80 and it's not secure, or 443 and it's secure, false otherwise.
      • getPort

        public int getPort()
        Gets the port of the server.
        Returns:
        The port, where the value -1 for default is changed to 80 for non-secure, or 443 for secure.
      • isSecure

        public boolean isSecure()
        Gets if SSL is used or not.
        Returns:
        The isSecure flag.
      • isRedirectionAllowed

        public boolean isRedirectionAllowed()
        Returns whether redirection to another server is allowed.
        Returns:
        The isRedirectionAllowed flag.
      • toString

        public java.lang.String toString()
        Creates a string representation of the instance.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String formatted as hostName[:port][,secure][,redirectionAllowed].
      • hashCode

        public int hashCode()
        Returns the hashCode.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hash code.
      • equals

        public boolean equals​(java.lang.Object obj)
        Checks if two destination server object are equal.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The object to compare with.
        Returns:
        Equals flag.