Class UriUtil
- java.lang.Object
-
- de.uplanet.lucy.server.auxiliaries.UriUtil
-
@VelocityVariable("UriUtil") @VelocityCallable("singleton") public final class UriUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description UriUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description de.uplanet.lucy.server.util.URIcreateAbsoluteBaseUrl()Create an absolute base URL from the given portal configuration.de.uplanet.lucy.server.util.URIcreateAbsoluteDefaultDocumentUrl()Deprecated.UsecreateAbsoluteBaseUrl()instead.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(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(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.StringmakeAbsoluteOrIxRootRelativePath(String p_strPath)Converts an relative web path to an Intrexx root relative path.StringmakeIxRootRelativePath(String p_strPath)Converts an relative web path to an Intrexx root relative path.de.uplanet.lucy.server.util.URIparseUri(String p_strUri)Create an URI from the given string.
-
-
-
Method Detail
-
makeIxRootRelativePath
public String makeIxRootRelativePath(String p_strPath)
Converts an 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
public String makeAbsoluteOrIxRootRelativePath(String p_strPath)
Converts an 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
public boolean isSafeWebUrl(String p_strUrl)
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
public boolean isSafeWebUrl(String p_strUrl, boolean p_bAllowSingleQuotes)
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
public de.uplanet.lucy.server.util.URI parseUri(String p_strUri) throws URISyntaxException
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(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 URISyntaxExceptionCreate 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:
createRequestUri(IServerBridgeRequest)
-
createAbsoluteRequestUri
public de.uplanet.lucy.server.util.URI createAbsoluteRequestUri(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 URISyntaxExceptionCreate 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:
createAbsoluteRequestUri(IServerBridgeRequest)
-
createAbsoluteBaseUrl
public de.uplanet.lucy.server.util.URI createAbsoluteBaseUrl() throws URISyntaxExceptionCreate 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 URISyntaxException
Deprecated.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()
-
-