Class UriUtil
java.lang.Object
de.uplanet.lucy.server.auxiliaries.UriUtil
@VelocityVariable("UriUtil")
@VelocityCallable("singleton")
public final class UriUtil
extends Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionde.uplanet.lucy.server.util.URICreate an absolute base URL from the given portal configuration.de.uplanet.lucy.server.util.URIDeprecated.de.uplanet.lucy.server.util.URIcreateAbsoluteRequestUri(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.URIcreateAbsoluteRequestUri(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.URIcreateRequestUri(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.URIcreateRequestUri(de.uplanet.lucy.server.connector.IServerBridgeRequest p_request) Create the request URI from value given in the request-line of the given request.booleanisSafeWebUrl(String p_strUrl) CallsisSafeWebUrl(String, boolean)with the second parameter set tofalseto disallow single quotes in the URL.booleanisSafeWebUrl(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.URICreate 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 tofalseto disallow single quotes in the URL.- Parameters:
p_strUrl- The URL.- Returns:
trueif the URL is considered safe, orfalseotherwise.
-
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-trueif single quotes are allowed to occur in the attribute value, orfalseotherwise.- Returns:
trueif the URL is considered safe, orfalseotherwise.
-
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_URIserver 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_URIserver 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_URIserver 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_URIserver 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.cfgconfiguration file as the/portal/uris/uri[@name='web.url.base.default']parameter.- Returns:
- The base directory URL, or
nullif 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.