Class HttpServerLocationImpl

java.lang.Object
net.officefloor.server.http.impl.HttpServerLocationImpl
All Implemented Interfaces:
HttpServerLocation

public class HttpServerLocationImpl extends Object implements HttpServerLocation
HttpServerLocation implementation.
Author:
Daniel Sagenschneider
  • Field Details

    • DEFAULT_HTTP_PORT

      public static final int DEFAULT_HTTP_PORT
      Default HTTP port.
      See Also:
    • DEFAULT_HTTPS_PORT

      public static final int DEFAULT_HTTPS_PORT
      Default HTTPS port.
      See Also:
  • Constructor Details

    • HttpServerLocationImpl

      public HttpServerLocationImpl()
      Instantiate with defaults for testing.
    • HttpServerLocationImpl

      public HttpServerLocationImpl(SourceContext context)
      Instantiate from Property values configured firstly from SourceContext, then System (then defaults).
      Parameters:
      context - SourceContext.
    • HttpServerLocationImpl

      public HttpServerLocationImpl(String domain, int httpPort, int httpsPort)
      Instantiate for running single instance.
      Parameters:
      domain - Domain.
      httpPort - HTTP port.
      httpsPort - HTTPS port.
    • HttpServerLocationImpl

      public HttpServerLocationImpl(String domain, int httpPort, int httpsPort, String clusterHostName)
      Instantiate for running in a cluster with same port mappings.
      Parameters:
      domain - Domain.
      httpPort - HTTP port.
      httpsPort - HTTPS port.
      clusterHostName - Cluster host name.
    • HttpServerLocationImpl

      public HttpServerLocationImpl(String domain, int httpPort, int httpsPort, String clusterHostName, int clusterHttpPort, int clusterHttpsPort)
      Instantiate for running in a cluster.
      Parameters:
      domain - Domain.
      httpPort - HTTP port.
      httpsPort - HTTPS port.
      clusterHostName - Cluster host name.
      clusterHttpPort - Cluster HTTP port.
      clusterHttpsPort - Cluster HTTPS port.
  • Method Details

    • getDefaultHostName

      public static String getDefaultHostName()
      Obtains the default host name.
      Returns:
      Default Host name.
    • getDomain

      public String getDomain()
      Description copied from interface: HttpServerLocation

      Obtains the domain for the server.

      This is as the client will see the server.

      Specified by:
      getDomain in interface HttpServerLocation
      Returns:
      Domain for the server.
    • getHttpPort

      public int getHttpPort()
      Description copied from interface: HttpServerLocation

      Obtains the HTTP port.

      This is as the client will see the server.

      Specified by:
      getHttpPort in interface HttpServerLocation
      Returns:
      HTTP port.
    • getHttpsPort

      public int getHttpsPort()
      Description copied from interface: HttpServerLocation

      Obtains the HTTPS port.

      This is as the client will see the server.

      Specified by:
      getHttpsPort in interface HttpServerLocation
      Returns:
      HTTPS port.
    • getClusterHostName

      public String getClusterHostName()
      Description copied from interface: HttpServerLocation
      Obtains the name of the host for the server within the cluster. This name should be understood by all nodes within the cluster.
      Specified by:
      getClusterHostName in interface HttpServerLocation
      Returns:
      Name of the host within the cluster.
    • getClusterHttpPort

      public int getClusterHttpPort()
      Description copied from interface: HttpServerLocation
      The cluster may be behind a load balancer and the server may be running on a different port than expected by the client.
      Specified by:
      getClusterHttpPort in interface HttpServerLocation
      Returns:
      Actual port on the cluster host the server is running on.
    • getClusterHttpsPort

      public int getClusterHttpsPort()
      Description copied from interface: HttpServerLocation
      The cluster may be behind a load balancer and the server may be running on a different port than expected by the client.
      Specified by:
      getClusterHttpsPort in interface HttpServerLocation
      Returns:
      Actual secure port on the cluster host the server is running on.
    • createClientUrl

      public String createClientUrl(boolean isSecure, String path)
      Description copied from interface: HttpServerLocation
      Creates the client URL to call the HttpServer.
      Specified by:
      createClientUrl in interface HttpServerLocation
      Parameters:
      isSecure - If secure URL.
      path - Path including query string and fragment.
      Returns:
      URL for the client to call on the HttpServer.