Class Url
java.lang.Object
org.sentrysoftware.metricshub.engine.client.http.Url
Utility class for formatting URLs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringformat(@NonNull String hostname, @NonNull Integer port, @NonNull String requestPath, @NonNull String protocol) Generate the full URL based on the Path only.static StringGenerate the full URL based on the concatenation of URL and Path.static StringGenerate the full URL.
-
Constructor Details
-
Url
public Url()
-
-
Method Details
-
format
public static String format(@NonNull @NonNull String hostname, @NonNull @NonNull Integer port, @NonNull @NonNull String requestPath, @NonNull @NonNull String protocol) Generate the full URL based on the Path only.- Parameters:
hostname- hostnameport- port of the requestrequestPath- request path of the requestprotocol- protocol used by the request- Returns:
- formatted String
-
format
Generate the full URL based on the concatenation of URL and Path.- Parameters:
url- full URL inserted in the resourcepath- request path- Returns:
- formatted String URL
-
format
public static String format(String protocol, String hostname, Integer port, String path, String url) Generate the full URL.- Parameters:
protocol- protocol used by the request.hostname- hostname.port- port of the request.path- request path of the request.url- full URL if specified.- Returns:
- formatted String URL.
- Throws:
IllegalArgumentException- when neither URL nor path are specified for the source to monitor.
-