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.URI
createAbsoluteBaseUrl()
Create an absolute base URL from the given portal configuration.de.uplanet.lucy.server.util.URI
createAbsoluteDefaultDocumentUrl()
Deprecated.UsecreateAbsoluteBaseUrl()
instead.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(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(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.String
makeAbsoluteOrIxRootRelativePath(String p_strPath)
Converts an relative web path to an Intrexx root relative path.String
makeIxRootRelativePath(String p_strPath)
Converts an relative web path to an Intrexx root relative path.de.uplanet.lucy.server.util.URI
parseUri(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 tofalse
to disallow single quotes in the URL.- Parameters:
p_strUrl
- The URL.- Returns:
true
if the URL is considered safe, orfalse
otherwise.
-
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
-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
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_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:
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_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:
createAbsoluteRequestUri(IServerBridgeRequest)
-
createAbsoluteBaseUrl
public de.uplanet.lucy.server.util.URI createAbsoluteBaseUrl() throws URISyntaxException
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 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()
-
-