Package lumis.portal.url
Class URLUtil
- java.lang.Object
-
- lumis.portal.url.URLUtil
-
public abstract class URLUtil extends Object
Utility class for URL related actions.- Since:
- 8.1.0
- Version:
- $Revision: 21231 $ $Date: 2018-04-24 19:34:27 -0300 (Tue, 24 Apr 2018) $
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PageWebResource
getFirstPageWebResource(ChannelWebResource cwr)
Returns the page web resource for the first page whithin the channel of the given channel web resource.static String
getHost(URI uri)
Returns the host of the given URI ornull
if none could be inferred.static String
getRefererPath(String referer, IWebsiteBaseURL baseURL, HttpServletRequest request)
Get the Web Resource path from the given URLstatic String
getRefererRelativeUri(String referer, IWebsiteBaseURL baseURL, HttpServletRequest request)
Returns the URI relative to the application root, without the mode root path, including the query string.static URI
removeDefaultPort(URI uri)
Remove default port of the given URI.
It removes the port if:
The scheme ishttp
and the port is80
; or The scheme ishttps
and the port is443
If the given URI is not absolute, is opaque or doesn't fit the above rule, the original URI will be returned.
-
-
-
Method Detail
-
getRefererPath
public static String getRefererPath(String referer, IWebsiteBaseURL baseURL, HttpServletRequest request)
Get the Web Resource path from the given URL- Parameters:
referer
- The URL to get the path frombaseURL
- The WebsiteBaseURLrequest
- The HttpServletRequest- Returns:
- A string corresponding to the web resource path of the URL
- Since:
- 8.1.0
-
getRefererRelativeUri
public static String getRefererRelativeUri(String referer, IWebsiteBaseURL baseURL, HttpServletRequest request)
Returns the URI relative to the application root, without the mode root path, including the query string.- Parameters:
referer
- The URL to get the path frombaseURL
- The WebsiteBaseURLrequest
- The HttpServletRequest- Returns:
- A string corresponding to the relative uri.
- Since:
- 10.4.0
-
getFirstPageWebResource
public static PageWebResource getFirstPageWebResource(ChannelWebResource cwr) throws PortalException
Returns the page web resource for the first page whithin the channel of the given channel web resource.This method requires a current session and a current transaction.
- Parameters:
cwr
- the channel web resource.- Returns:
- the page web resource for the first page whithin the channel of the given channel web resource.
- Throws:
PortalException
- Since:
- 10.3.0
-
getHost
public static String getHost(URI uri)
Returns the host of the given URI ornull
if none could be inferred.- Parameters:
uri
- the URI.- Returns:
- the host of the given URI or
null
if none could be inferred. - Since:
- 10.3.0
-
removeDefaultPort
public static URI removeDefaultPort(URI uri)
Remove default port of the given URI.
It removes the port if:
-
The scheme is
http
and the port is80
; or -
The scheme is
https
and the port is443
If the given URI is not absolute, is opaque or doesn't fit the above rule, the original URI will be returned.- Parameters:
uri
- the URI to have its default port removed.- Returns:
- the given URI without the default port (if any).
- Throws:
NullPointerException
- if the given URI isnull
.- Since:
- 10.4.0
-
The scheme is
-
-