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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    de.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)
    Calls isSafeWebUrl(String, boolean) with the second parameter set to false 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.
    Converts a relative web path to an Intrexx root relative path.
    Converts a 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.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UriUtil

      public UriUtil()
  • Method Details

    • makeIxRootRelativePath

      public String makeIxRootRelativePath(String p_strPath)
      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

      public String makeAbsoluteOrIxRootRelativePath(String p_strPath)
      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

      public boolean isSafeWebUrl(String p_strUrl)
      Calls isSafeWebUrl(String, boolean) with the second parameter set to false to disallow single quotes in the URL.
      Parameters:
      p_strUrl - The URL.
      Returns:
      true if the URL is considered safe, or false 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, or https, or ftp, 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, or false otherwise.
      Returns:
      true if the URL is considered safe, or false 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(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 a REQUEST_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 a REQUEST_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 a SCHEME, HTTP_HOST, and REQUEST_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 a SCHEME, HTTP_HOST, and REQUEST_URI server variable.
      URISyntaxException - If a parsing error occurred.
      See Also:
    • 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.
      Since Intrexx does not have a default document anymore this method simply delegates to createAbsoluteBaseUrl().
      Throws:
      URISyntaxException - If a parsing error occurred.
      See Also: