Class UriUtil
java.lang.Object
de.uplanet.lucy.server.auxiliaries.UriUtil
@VelocityVariable("UriUtil")
@VelocityCallable("singleton")
public final class UriUtil
extends Object
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionde.uplanet.lucy.server.util.URI
Create an absolute base URL from the given portal configuration.de.uplanet.lucy.server.util.URI
Deprecated.de.uplanet.lucy.server.util.URI
createAbsoluteRequestUri
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Create the absolute request URI from the scheme, host, and the request URI given in the request-line of the given request.de.uplanet.lucy.server.util.URI
createAbsoluteRequestUri
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Create the absolute request URI from the scheme, host, and the request URI given in the request-line of the given request.de.uplanet.lucy.server.util.URI
createRequestUri
(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) Create the request URI from value given in the request-line of the given request.de.uplanet.lucy.server.util.URI
createRequestUri
(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Create the request URI from value given in the request-line of the given request.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.makeAbsoluteOrIxRootRelativePath
(String p_strPath) Converts a relative web path to an Intrexx root relative path.makeIxRootRelativePath
(String p_strPath) Converts a relative web path to an Intrexx root relative path.de.uplanet.lucy.server.util.URI
Create an URI from the given string.
-
Constructor Details
-
UriUtil
public UriUtil()
-
-
Method Details
-
makeIxRootRelativePath
Converts a relative web path to an Intrexx root relative path. Used for compatibility between Intrexx 20.3 and Intrexx Version before 20.3. Before Intrexx 20.3 root paths: images/... From Intrexx 20.3 root paths: /images/...- Parameters:
p_strPath
- The path.- Returns:
- Returns the given path. If the path not started with an slash or dot the path will returned with an slash as beginning otherwise the given path is returned.
-
makeAbsoluteOrIxRootRelativePath
Converts a relative web path to an Intrexx root relative path. Used for compatibility between Intrexx 20.3 and Intrexx Version before 20.3. Before Intrexx 20.3 root paths: images/... From Intrexx 20.3 root paths: /images/...- Parameters:
p_strPath
- The path.- Returns:
- Returns the given path. If the path not started with an slash or dot the path will returned with an slash as beginning otherwise the given path is returned.
-
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 from the given string.- Parameters:
p_strUri
- The string to be parsed.- Returns:
- The URI.
- Throws:
URISyntaxException
- If a parsing error occurred.
-
createRequestUri
public de.uplanet.lucy.server.util.URI createRequestUri(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) throws URISyntaxException Create the request URI from value given in the request-line of the given request.- Parameters:
p_request
- The request.- Returns:
- The request URI.
- Throws:
URISyntaxException
- If a parsing error occurred.IllegalStateException
- If the given request does not contain aREQUEST_URI
server variable.
-
createRequestUri
public de.uplanet.lucy.server.util.URI createRequestUri(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) throws URISyntaxException Create the request URI from value given in the request-line of the given request.- Parameters:
p_ctx
- The request processing context.- Returns:
- The request URI.
- Throws:
URISyntaxException
- If a parsing error occurred.IllegalStateException
- If the given request does not contain aREQUEST_URI
server variable.- See Also:
-
createAbsoluteRequestUri
public de.uplanet.lucy.server.util.URI createAbsoluteRequestUri(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) throws URISyntaxException Create the absolute request URI from the scheme, host, and the request URI given in the request-line of the given request.- Parameters:
p_request
- The request.- Returns:
- The request URI.
- Throws:
IllegalStateException
- If the given request does not contain aSCHEME
,HTTP_HOST
, andREQUEST_URI
server variable.URISyntaxException
- If a parsing error occurred.
-
createAbsoluteRequestUri
public de.uplanet.lucy.server.util.URI createAbsoluteRequestUri(de.uplanet.lucy.server.connector.IRequestProcessingContext p_ctx) throws URISyntaxException Create the absolute request URI from the scheme, host, and the request URI given in the request-line of the given request.- Parameters:
p_ctx
- The request processing context.- Returns:
- The absolute request URI.
- Throws:
IllegalStateException
- If the given request does not contain aSCHEME
,HTTP_HOST
, andREQUEST_URI
server variable.URISyntaxException
- If a parsing error occurred.- See Also:
-
createAbsoluteBaseUrl
Create an absolute base URL from the given portal configuration.Normally, the URL is configured in the
internal/cfg/portal.cfg
configuration file as the/portal/uris/uri[@name='web.url.base.default']
parameter.- Returns:
- The base directory URL, or
null
if the base URL has not been configured yet. In the latter case an error is written to the portal log. - Throws:
URISyntaxException
- If a parsing error occurred.
-
createAbsoluteDefaultDocumentUrl
@Deprecated public de.uplanet.lucy.server.util.URI createAbsoluteDefaultDocumentUrl() throws URISyntaxExceptionDeprecated.UsecreateAbsoluteBaseUrl()
instead.Since Intrexx does not have a default document anymore this method simply delegates tocreateAbsoluteBaseUrl()
.- Throws:
URISyntaxException
- If a parsing error occurred.- See Also:
-
createAbsoluteBaseUrl()
instead.