Class URLUtil
java.lang.Object
com.atlassian.jira.functest.framework.util.url.URLUtil
- Since:
- v3.13
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
addXsrfToken
(String token, String url) Adds a token to a given url in the FIRST positionstatic boolean
compareURLStrings
(String controlLink, String testLink) Compares 2 URL strings for equality.static String
The opposite ofencode(String)
static String
Can be called to encode a parameter part of an URLstatic String
getQueryParamValueFromUrl
(String url, String paramName) static String
getQueryParamValueFromUrl
(URL url, String paramName)
-
Constructor Details
-
URLUtil
public URLUtil()
-
-
Method Details
-
compareURLStrings
Compares 2 URL strings for equality. Two URLs will be equal, if their baseURL is the same, and they have the same parameters (regardless of ordering). The baseURL does not include contextPath.For example: ViewWorkflowSteps.jspa?workflowMode=live&workflowName=Dude AND /jira/ViewWorkflowSteps.jspa?workflowName=Dude&workflowMode=live are deemed to be equal by this method.
Amazingly enough I couldn't find an open source helper that already does this!
- Parameters:
controlLink
- The link assumed to be correct.testLink
- The link being tested.- Returns:
- True if the two links are correct.
-
getQueryParamValueFromUrl
- Parameters:
url
- the url to process e.g.http://www.atlassian.com/search?blablabla=haha&test=two
paramName
- the name of the parameter to retrieve the value of- Returns:
- the value of the query parameter from the URL string; null if there was no query part or the fieldId could not be found.
-
getQueryParamValueFromUrl
- Parameters:
url
- the url to processparamName
- the name of the parameter to retrieve the value of- Returns:
- the value of the query parameter from the URL string; null if there was no query part or the fieldId could not be found.
-
addXsrfToken
Adds a token to a given url in the FIRST position- Parameters:
token
- the tokenurl
- the url in question- Returns:
- the url with the token in place
-
encode
Can be called to encode a parameter part of an URL- Parameters:
urlParam
- the parameter to be plaved into a URL- Returns:
- the encoded data
-
decode
The opposite ofencode(String)
- Parameters:
urlParam
- the param to decode- Returns:
- the decoded value
-