Package com.atlassian.bamboo.utils
Class UrlUtils
- java.lang.Object
-
- com.atlassian.bamboo.utils.UrlUtils
-
public class UrlUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description UrlUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getPathUnderContext(@NotNull String url, @NotNull String context)
Given an URL which may: - include scheme,host and optionally port - start directly with context - start with an arbitrary path under a context this method returns the path under context.static boolean
isSafeUrl(String returnUrl)
Validate if passed URL uses HTTP or HTTPS schema or there's no indication that any type of schema is used altogether.
-
-
-
Method Detail
-
isSafeUrl
public static boolean isSafeUrl(String returnUrl)
Validate if passed URL uses HTTP or HTTPS schema or there's no indication that any type of schema is used altogether. This method expects URL decoded value as input. It is safe to pass Struts' action parameter which is URL decoded and trimmed.- Parameters:
returnUrl
- URL decoded value of returnUrl query param
-
getPathUnderContext
public static String getPathUnderContext(@NotNull @NotNull String url, @NotNull @NotNull String context)
Given an URL which may: - include scheme,host and optionally port - start directly with context - start with an arbitrary path under a context this method returns the path under context. It should not be used for security purposes, because it operates on best effort basis - including returning the URL without modifications if context is not found .- See Also:
for context description
-
-