public class UrlUtils extends Object
Modifier and Type | Method and Description |
---|---|
static @NotNull String |
appendSlashIfDoesntExist(@Nullable String theString)
Checks whether or not the given string has a '/' character as the last character, and appends one if it doesn't
|
static String |
constructBaseUrl(javax.servlet.http.HttpServletRequest request)
Attempts to construct a baseUrl using the
HttpServletRequest object. |
static String |
correctlyFormatUrl(String host) |
static @NotNull URL |
createUrl(@NotNull String url) |
static @NotNull URL |
createUrl(@NotNull String context,
@NotNull String formActionDestination) |
static @NotNull com.google.common.collect.Multimap<String,String> |
extractQueryParams(@NotNull String url) |
static @NotNull com.google.common.collect.Multimap<String,String> |
extractQueryParams(@NotNull URI uri) |
static @NotNull com.google.common.collect.Multimap<String,String> |
extractQueryParams(@NotNull URL url) |
static @Nullable String |
extractSingleQueryParam(@NotNull String url,
@NotNull String paramName) |
static @Nullable String |
extractSingleQueryParam(@NotNull URL url,
@NotNull String paramName) |
static String |
getPathUnderContext(@NotNull String url,
@NotNull String context)
Deprecated.
|
static boolean |
hasXssRelatedCharacters(@Nullable String string) |
static boolean |
isSameOrigin(@NotNull URL url,
@NotNull URL origin) |
static @NotNull String |
prependSlashIfDoesntExist(@Nullable String theString)
Checks whether or not the given string has a '/' character as the first character, and puts one in if it doesn't
|
static @Nullable String |
replaceOrInsertParamValue(String queryString,
String newParamValue) |
static String |
replacePlanResultKeyInUrl(String url,
PlanKey planKey,
int newBuildNumber) |
static @NotNull String |
sanitizeUri(@NotNull String uri)
Removes XSS related characters from URI: backslash, double and single quotes, angle brackets.
|
static @NotNull String |
stripLeadingSlashes(@Nullable String toStrip)
Strips any leading '/' characters off the front of the string, if any.
|
static @NotNull String |
stripQueryAndRef(@NotNull String url) |
static @NotNull String |
stripTailingSlashes(@Nullable String toStrip)
Strips any leading '/' characters off the end of the string, if any.
|
@NotNull public static @NotNull String sanitizeUri(@NotNull @NotNull String uri)
uri
- @Nullable public static @Nullable String replaceOrInsertParamValue(String queryString, String newParamValue)
public static String replacePlanResultKeyInUrl(String url, PlanKey planKey, int newBuildNumber)
@NotNull public static @NotNull String stripLeadingSlashes(@Nullable @Nullable String toStrip)
toStrip
- - the string to strip@NotNull public static @NotNull String stripTailingSlashes(@Nullable @Nullable String toStrip)
toStrip
- - the string to strip@NotNull public static @NotNull String appendSlashIfDoesntExist(@Nullable @Nullable String theString)
theString
- to check and append.@NotNull public static @NotNull String prependSlashIfDoesntExist(@Nullable @Nullable String theString)
theString
- to check and prepend.@NotNull public static @NotNull String stripQueryAndRef(@NotNull @NotNull String url)
@Deprecated public static String getPathUnderContext(@NotNull @NotNull String url, @NotNull @NotNull String context)
UrlUtils.getPathUnderContext(java.lang.String, java.lang.String)
for context description
@NotNull public static @NotNull com.google.common.collect.Multimap<String,String> extractQueryParams(@NotNull @NotNull URL url)
@NotNull public static @NotNull com.google.common.collect.Multimap<String,String> extractQueryParams(@NotNull @NotNull String url)
@NotNull public static @NotNull com.google.common.collect.Multimap<String,String> extractQueryParams(@NotNull @NotNull URI uri)
@Nullable public static @Nullable String extractSingleQueryParam(@NotNull @NotNull URL url, @NotNull @NotNull String paramName)
@Nullable public static @Nullable String extractSingleQueryParam(@NotNull @NotNull String url, @NotNull @NotNull String paramName)
public static boolean isSameOrigin(@NotNull @NotNull URL url, @NotNull @NotNull URL origin)
url
- the url to checkorigin
- the origin to check against.@NotNull public static @NotNull URL createUrl(@NotNull @NotNull String context, @NotNull @NotNull String formActionDestination)
public static String constructBaseUrl(javax.servlet.http.HttpServletRequest request)
HttpServletRequest
object.request
- The incoming http requestpublic static boolean hasXssRelatedCharacters(@Nullable @Nullable String string)
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.