Package org.codice.ddf.test.common
Class UrlBuilder
java.lang.Object
org.codice.ddf.test.common.UrlBuilder
Builder class for URLs.
-
Method Summary
Modifier and TypeMethodDescriptionAdds a context path to an existing URL.build()Builds an http URL from the base URL information provided and all the context paths added.Builds an https URL from the base URL information provided and all the context paths added.static UrlBuilderCreates aUrlBuilderfrom static values.static UrlBuilderfromSystemProperties(String hostnameSystemProperty, String portSystemProperty, String securePortSystemProperty, String rootContextSystemProperty) Creates aUrlBuilderfrom system property values.
-
Method Details
-
from
Creates aUrlBuilderfrom static values.- Parameters:
hostname- host name to use in the URLport- port to use in the URLsecurePort- secure port to use in the URLrootContext- root context of the URL- Returns:
- new
UrlBuilderinstance
-
fromSystemProperties
public static UrlBuilder fromSystemProperties(String hostnameSystemProperty, String portSystemProperty, String securePortSystemProperty, String rootContextSystemProperty) Creates aUrlBuilderfrom system property values.- Parameters:
hostnameSystemProperty- name of the system property that contains the host name to use in the URLportSystemProperty- name of the system property that contains the port to use in the URLsecurePortSystemProperty- name of the system property that contains the secure port to use in the URLrootContextSystemProperty- name of the system property that contains the root context of the URL- Returns:
- new
UrlBuilderinstance
-
add
Adds a context path to an existing URL. The method will take care of adding and/or removing any extraneous/at the beginning or end of the context path provided to guarantee that the URL is always valid.- Parameters:
contextPath- context path to add to the URL- Returns:
- this
UrlBuilder
-
build
Builds an http URL from the base URL information provided and all the context paths added.- Returns:
- http URL
-
buildSecure
Builds an https URL from the base URL information provided and all the context paths added.- Returns:
- https URL
-