Package com.xceptance.xlt.api.util
Class BasicPageUtils
- java.lang.Object
-
- com.xceptance.xlt.api.util.BasicPageUtils
-
- Direct Known Subclasses:
HtmlPageUtils
,LightweightHtmlPageUtils
public class BasicPageUtils extends java.lang.Object
TheBasicPageUtils
class provides common helper methods for its child classes. It is not meant to be used directly.- See Also:
HtmlPageUtils
,LightweightHtmlPageUtils
-
-
Constructor Summary
Constructors Constructor Description BasicPageUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getAbsoluteUrl(java.lang.String baseUrl, java.lang.String relativePath)
Returns an absolute URL built from the passed base URL and relative path.static java.lang.String
getAbsoluteUrl(java.net.URL baseUrl, java.lang.String relativePath)
Returns an absolute URL built from the passed base URL and relative path.static <T> T
pickOneRandomly(java.util.List<T> elements)
Returns one entry from the passed list, chosen randomly.static <T> T
pickOneRandomly(java.util.List<T> elements, boolean excludeFirst)
Returns one entry from the passed list, chosen randomly.static <T> T
pickOneRandomly(java.util.List<T> elements, boolean excludeFirst, boolean excludeLast)
Returns one entry from the passed list, chosen randomly.
-
-
-
Method Detail
-
getAbsoluteUrl
public static java.lang.String getAbsoluteUrl(java.lang.String baseUrl, java.lang.String relativePath) throws java.net.MalformedURLException
Returns an absolute URL built from the passed base URL and relative path.- Parameters:
baseUrl
- the base URL as a stringrelativePath
- the relative path- Returns:
- the new absolute URL
- Throws:
java.net.MalformedURLException
- if the new URL is invalid
-
getAbsoluteUrl
public static java.lang.String getAbsoluteUrl(java.net.URL baseUrl, java.lang.String relativePath) throws java.net.MalformedURLException
Returns an absolute URL built from the passed base URL and relative path.- Parameters:
baseUrl
- the base URLrelativePath
- the relative path- Returns:
- the new absolute URL
- Throws:
java.net.MalformedURLException
- if the new URL is invalid
-
pickOneRandomly
public static <T> T pickOneRandomly(java.util.List<T> elements)
Returns one entry from the passed list, chosen randomly.- Type Parameters:
T
- the type of the elements in the list- Parameters:
elements
- the list- Returns:
- one element from the list
-
pickOneRandomly
public static <T> T pickOneRandomly(java.util.List<T> elements, boolean excludeFirst)
Returns one entry from the passed list, chosen randomly. It can be specified whether or not the first entry is to be ignored.- Type Parameters:
T
- the type of the elements in the list- Parameters:
elements
- the listexcludeFirst
- whether or not the first entry is to be excluded- Returns:
- one element from the list
-
pickOneRandomly
public static <T> T pickOneRandomly(java.util.List<T> elements, boolean excludeFirst, boolean excludeLast)
Returns one entry from the passed list, chosen randomly. It can be specified whether or not the first and/or the last entries are to be ignored.- Type Parameters:
T
- the type of the elements in the list- Parameters:
elements
- the listexcludeFirst
- whether or not the first entry is to be excludedexcludeLast
- whether or not the last entry is to be excluded- Returns:
- one element from the list
-
-