Class UrlBuilder
java.lang.Object
de.uplanet.lucy.server.auxiliaries.UrlBuilder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionde.uplanet.lucy.server.util.URL
createAbsoluteBaseDirectoryUrl
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Deprecated.de.uplanet.lucy.server.util.URL
createAbsoluteBaseDirectoryUrl
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Deprecated.UsecreateAbsoluteBaseUrl(IServerBridgeRequest)
instead.de.uplanet.lucy.server.util.URL
createAbsoluteBaseUrl
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) de.uplanet.lucy.server.util.URL
createAbsoluteBaseUrl
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Create an absolute base URL from the given request.de.uplanet.lucy.server.util.URL
createAbsoluteRequestBaseDirectoryUrl
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Reconstructs the URL the client used to make the request.de.uplanet.lucy.server.util.URL
createAbsoluteRequestBaseDirectoryUrl
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Reconstructs the URL the client used to make the request.de.uplanet.lucy.server.util.URL
createBaseUrl
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Create a base URL, i.e. a relative URL containing solely the root path/
.de.uplanet.lucy.server.util.URL
createBaseUrl
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Create a base URL, i.e. a relative URL containing solely the root path/
.de.uplanet.lucy.server.util.URL
createDefaultUrl
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Deprecated.UsecreateBaseUrl(IRequestProcessingContext)
instead.de.uplanet.lucy.server.util.URL
createDefaultUrl
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Deprecated.UsecreateBaseUrl(IServerBridgeRequest)
instead.de.uplanet.lucy.server.util.URL
createRequestBaseDirectoryUrl
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Deprecated.de.uplanet.lucy.server.util.URL
createRequestBaseDirectoryUrl
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Deprecated.de.uplanet.lucy.server.util.URL
createWebSocketBaseUrl
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) de.uplanet.lucy.server.util.URL
createWebSocketBaseUrl
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Create a WebSocket URL from the given request.Percent encode the given URI using UTF-8 as character set..boolean
isSafeWebUrl
(String p_strUrl) CallsisSafeWebUrl(String, boolean)
with the second parameter set tofalse
to disallow single quotes in the URL.boolean
isSafeWebUrl
(String p_strUrl, boolean p_bAllowSingleQuotes) Check if the given URL is a safe URL in Intrexx' sense.boolean
isValidUri
(String p_str) Validate given URLs.boolean
isValidUrl
(String p_str) Validate given URLs.Create an URI object from the given URI.de.uplanet.lucy.server.util.URL
Create an URL from the given string.
-
Constructor Details
-
UrlBuilder
public UrlBuilder()
-
-
Method Details
-
createBaseUrl
public de.uplanet.lucy.server.util.URL createBaseUrl(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Create a base URL, i.e. a relative URL containing solely the root path/
.- Parameters:
p_request
- The request.- Returns:
- The
/
base URL.
-
createBaseUrl
public de.uplanet.lucy.server.util.URL createBaseUrl(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Create a base URL, i.e. a relative URL containing solely the root path/
.- Parameters:
p_ctx
- The processing context.- Returns:
- The
/
base URL. - See Also:
-
createAbsoluteBaseUrl
public de.uplanet.lucy.server.util.URL createAbsoluteBaseUrl(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) throws MalformedURLException Create an absolute base URL from the given request.The returned absolute URL will always contain a terminating slash
/
.This method tries to create an absolute base URL as follows
- First, if the
doc("internal/cfg/portal.cfg")/portal/uris/uri[@name='web.url.base.default']
configuration parameter exists, return it. This is the preferred way. The following is a fallback in case the portal's default URL is not configured. - Second, try to create an absolute URL from
SERVERVAR.SCHEME
,SERVERVAR.SERVER_NAME
,SERVERVAR.SERVER_PORT
, and return it.
- Parameters:
p_request
- The request.- Returns:
- The base URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
- First, if the
-
createAbsoluteBaseUrl
public de.uplanet.lucy.server.util.URL createAbsoluteBaseUrl(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) throws MalformedURLException - Throws:
MalformedURLException
- See Also:
-
createWebSocketBaseUrl
public de.uplanet.lucy.server.util.URL createWebSocketBaseUrl(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) throws MalformedURLException Create a WebSocket URL from the given request.This method uses the same algorithm as
createAbsoluteBaseUrl(IServerBridgeRequest)
except that the scheme isws
orwss
instead ofhttp
orhttps
.- Parameters:
p_request
- The request.- Returns:
- The WebSocket URL.
- Throws:
MalformedURLException
- If a parsing error occurred.- See Also:
-
createWebSocketBaseUrl
public de.uplanet.lucy.server.util.URL createWebSocketBaseUrl(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) throws MalformedURLException - Throws:
MalformedURLException
- See Also:
-
createAbsoluteRequestBaseDirectoryUrl
public de.uplanet.lucy.server.util.URL createAbsoluteRequestBaseDirectoryUrl(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) throws MalformedURLException Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, (optional) port number, and server path without the document part.The document part is the rightmost path component that is not followed by a slash.
- Parameters:
p_request
- The request.- Returns:
- The request base directory URL.
- Throws:
MalformedURLException
-
createAbsoluteRequestBaseDirectoryUrl
public de.uplanet.lucy.server.util.URL createAbsoluteRequestBaseDirectoryUrl(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) throws MalformedURLException Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, (optional) port number, and server path without the document part.The document part is the rightmost path component that is not followed by a slash.
- Parameters:
p_ctx
- The processing context.- Returns:
- The request base directory URL.
- Throws:
MalformedURLException
- If a parsing error occurred.- See Also:
-
parseUrl
Create an URL from the given string.- Parameters:
p_strUrl
- The string to be parsed.- Returns:
- The URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
isValidUri
Validate given URLs.- Parameters:
p_str
- The URL.- Returns:
true
if the URL is valid, orfalse
otherwise.
-
isValidUrl
Validate given URLs.- Parameters:
p_str
- The URL.- Returns:
true
if the URL is valid, orfalse
otherwise.
-
isSafeWebUrl
CallsisSafeWebUrl(String, boolean)
with the second parameter set tofalse
to disallow single quotes in the URL.- Parameters:
p_strUrl
- The URL.- Returns:
true
if the URL is considered safe, orfalse
otherwise.
-
isSafeWebUrl
Check if the given URL is a safe URL in Intrexx' sense.The URL must meet the following conditions to be considered a safe Web ULR:
- The URL must only contain characters allowed by the spec (http://tools.ietf.org/html/rfc3986).
- The URL must not contain numeric or named HTML character references.
- The scheme must be either
http
, orhttps
, orftp
, or the URL must be a relative URL. - If the URL is absolute it must have an authority part.
- If the URL is relative it must not have an authority part.
- Parameters:
p_strUrl
- The URL.p_bAllowSingleQuotes
-true
if single quotes are allowed to occur in the attribute value, orfalse
otherwise.- Returns:
true
if the URL is considered safe, orfalse
otherwise.
-
parseUri
Create an URI object from the given URI.- Parameters:
p_strUri
- The URI.- Returns:
- An URI object.
- Throws:
URISyntaxException
- If a syntax error occurred.
-
encodeUri
Percent encode the given URI using UTF-8 as character set..- Parameters:
p_strUri
- The URI.- Returns:
- The encoded URI.
- Throws:
URISyntaxException
- If a syntax error occurred.
-
createDefaultUrl
@Deprecated public de.uplanet.lucy.server.util.URL createDefaultUrl(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Deprecated.UsecreateBaseUrl(IServerBridgeRequest)
instead.The same ascreateBaseUrl(IServerBridgeRequest)
.- Parameters:
p_request
- The request.- Returns:
- The URL.
-
createDefaultUrl
@Deprecated public de.uplanet.lucy.server.util.URL createDefaultUrl(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Deprecated.UsecreateBaseUrl(IRequestProcessingContext)
instead.The same ascreateBaseUrl(IRequestProcessingContext)
.- Parameters:
p_ctx
- The processing context.- Returns:
- The URL.
-
createAbsoluteBaseDirectoryUrl
@Deprecated public de.uplanet.lucy.server.util.URL createAbsoluteBaseDirectoryUrl(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) throws MalformedURLException Deprecated.UsecreateAbsoluteBaseUrl(IServerBridgeRequest)
instead.The same ascreateAbsoluteBaseUrl(IServerBridgeRequest)
.- Parameters:
p_request
- The request.- Returns:
- The URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
createAbsoluteBaseDirectoryUrl
@Deprecated public de.uplanet.lucy.server.util.URL createAbsoluteBaseDirectoryUrl(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) throws MalformedURLException Deprecated.UsecreateAbsoluteBaseUrl(IRequestProcessingContext)
instead.The same ascreateAbsoluteBaseUrl(IRequestProcessingContext)
.- Parameters:
p_ctx
- The processing context.- Returns:
- The URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
createRequestBaseDirectoryUrl
@Deprecated public de.uplanet.lucy.server.util.URL createRequestBaseDirectoryUrl(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) throws MalformedURLException Deprecated.- Parameters:
p_request
- The request.- Returns:
- The URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
createRequestBaseDirectoryUrl
@Deprecated public de.uplanet.lucy.server.util.URL createRequestBaseDirectoryUrl(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) throws MalformedURLException Deprecated.- Parameters:
p_ctx
- The processing context.- Returns:
- The URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
createAbsoluteBaseUrl(IRequestProcessingContext)
instead.