Class Endpoint

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

public class Endpoint extends de.iip_ecosphere.platform.support.ServerAddress
Implements a reusable server endpoint.
Author:
Holger Eichelberger, SSE
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
     
    private static final long
     

    Fields inherited from class de.iip_ecosphere.platform.support.ServerAddress

    LOCALHOST
  • Constructor Summary

    Constructors
    Constructor
    Description
    Endpoint(de.iip_ecosphere.platform.support.Schema schema, int port, String endpoint)
    Creates a new localhost endpoint instance.
    Endpoint(de.iip_ecosphere.platform.support.Schema schema, String endpoint)
    Creates a new localhost endpoint instance on an ephemerial port.
    Endpoint(de.iip_ecosphere.platform.support.Schema schema, String host, int port, String endpoint)
    Creates a new endpoint instance.
    Endpoint(de.iip_ecosphere.platform.support.ServerAddress server, String endpoint)
    Creates a new endpoint based on a given server address.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Checks/fixes an endpoint path.
    boolean
    equals(Object other)
     
    Returns the endpoint.
    int
     
    Returns the URI representation of this endpoint.
    static Endpoint
    Turns an URI into an endpoint.

    Methods inherited from class de.iip_ecosphere.platform.support.ServerAddress

    getHost, getPort, getSchema, isValidPort, toServerUri, validatePort

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Endpoint

      public Endpoint(de.iip_ecosphere.platform.support.Schema schema, String endpoint)
      Creates a new localhost endpoint instance on an ephemerial port.
      Parameters:
      schema - the schema
      endpoint - the endpoint path on the server (if it does not start with a "/", a leading "/" will be added)
    • Endpoint

      public Endpoint(de.iip_ecosphere.platform.support.Schema schema, int port, String endpoint)
      Creates a new localhost endpoint instance.
      Parameters:
      schema - the schema
      port - the port number (ignored if negative)
      endpoint - the endpoint path on the server (if it does not start with a "/", a leading "/" will be added)
    • Endpoint

      public Endpoint(de.iip_ecosphere.platform.support.Schema schema, String host, int port, String endpoint)
      Creates a new endpoint instance.
      Parameters:
      schema - the schema
      host - the hostname (turned to "localhost" if null or empty)
      port - the port number
      endpoint - the endpoint path on the server (if it does not start with a "/", a leading "/" will be added)
    • Endpoint

      public Endpoint(de.iip_ecosphere.platform.support.ServerAddress server, String endpoint)
      Creates a new endpoint based on a given server address.
      Parameters:
      server - the server address
      endpoint - the endpoint path on the server (if it does not start with a "/", a leading "/" will be added)
  • Method Details

    • getEndpoint

      public String getEndpoint()
      Returns the endpoint.
      Returns:
      the endpoint with leading "/"
    • toUri

      public String toUri()
      Returns the URI representation of this endpoint.
      Overrides:
      toUri in class de.iip_ecosphere.platform.support.ServerAddress
      Returns:
      the URI representation
    • checkEndpoint

      public static String checkEndpoint(String endpoint)
      Checks/fixes an endpoint path.
      Parameters:
      endpoint - the endpoint path
      Returns:
      the (fixed) endpoint path
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class de.iip_ecosphere.platform.support.ServerAddress
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class de.iip_ecosphere.platform.support.ServerAddress
    • valueOf

      public static Endpoint valueOf(String uri)
      Turns an URI into an endpoint.
      Parameters:
      uri - the URI
      Returns:
      the endpoint, may be null if not valid