Class URLUtil


  • public class URLUtil
    extends Object
    Class declaration
    Author:
    t.leroi
    • Constructor Detail

      • URLUtil

        public URLUtil()
    • Method Detail

      • getURL

        public static String getURL​(String sComponentName,
                                    String sSpace,
                                    String sComponentId)
        Parameters:
        sComponentName - - the componentName (ie kmelia, bookmark...)
        sSpace - - the space id
        sComponentId - - the componentId (ie kmelia12, bookmark578...)
        Returns:
        an String like '/RcomponentName/componentId/'
      • getURL

        @Deprecated(since="5.15")
        public static String getURL​(String sComponentName)
        Deprecated.
        Parameters:
        sComponentName - the name of a component.
        Returns:
        the URL to the component.
      • getComponentInstanceURL

        public static String getComponentInstanceURL​(String sComponentId)
      • getNewComponentURL

        public static String getNewComponentURL​(String spaceId,
                                                String componentId)
        Retourne l'URL pour les nouveaux composants lors de la recherche globale
        Parameters:
        spaceId - - l'id de l'espace (WA151)
        componentId - - l'id de l'instance de composant (trucsAstuces1042)
        Returns:
        la nouvelle URL
      • getApplicationURL

        public static String getApplicationURL()
        Returns The Application web context.
        Returns:
        The Application web context.
      • getFullApplicationURL

        public static String getFullApplicationURL​(javax.servlet.http.HttpServletRequest request)
      • getAbsoluteApplicationURL

        public static String getAbsoluteApplicationURL()
        Gets the absolute application URL when the treatment is executed into the context of a HTTP request.
        Returns:
        the absolute application URL as string.
      • getAbsoluteLocalApplicationURL

        public static String getAbsoluteLocalApplicationURL()
        Gets the absolute local application URL when the treatment is executed into the context of a HTTP request.
        Returns:
        the absolute local application URL as string.
      • setCurrentServerUrl

        public static void setCurrentServerUrl​(javax.servlet.http.HttpServletRequest request)
      • getCurrentServerURL

        public static String getCurrentServerURL()
      • getCurrentLocalServerURL

        public static String getCurrentLocalServerURL()
      • getLocalServerURL

        public static String getLocalServerURL​(javax.servlet.http.HttpServletRequest request)
      • getServerURL

        public static String getServerURL​(javax.servlet.http.HttpServletRequest request)
      • getHttpMode

        public static String getHttpMode()
      • displayUniversalLinks

        public static boolean displayUniversalLinks()
        Returns:
      • getSimpleURL

        public static String getSimpleURL​(int type,
                                          String id,
                                          String componentId)
      • getSimpleURL

        public static String getSimpleURL​(int type,
                                          String id,
                                          String componentId,
                                          boolean appendContext,
                                          String forumId)
      • getSimpleURL

        public static String getSimpleURL​(int type,
                                          String id,
                                          String componentId,
                                          boolean appendContext)
      • getSimpleURL

        public static String getSimpleURL​(int type,
                                          String id)
      • getSimpleURL

        public static String getSimpleURL​(int type,
                                          String id,
                                          boolean appendContext)
      • encodeURL

        public static String encodeURL​(String url)
        Translates a string into application/x-www-form-urlencoded format using a specific encoding scheme. The specified string is expected to be in the UTF-8 charset, otherwise it is returned as such.
        Parameters:
        url - an UTF-8 string representing an URL of a resource in Silverpeas.
        Returns:
        the encoded URL.
      • getPermalink

        public static String getPermalink​(URLUtil.Permalink permalink,
                                          String resourceId)
        Gets the permalink according to the specified parameters.
        Parameters:
        permalink - the permalink type.
        resourceId - the identifier of the resource.
        Returns:
        the permalink string.
      • isPermalink

        public static boolean isPermalink​(String url)
      • getSilverpeasVersion

        public static String getSilverpeasVersion()
      • setSilverpeasVersion

        public static void setSilverpeasVersion​(String version)
      • getSilverpeasFingerprint

        public static String getSilverpeasFingerprint()
      • addFingerprintVersionOn

        public static String addFingerprintVersionOn​(String url)
      • getMinifiedWebResourceUrl

        public static String getMinifiedWebResourceUrl​(String url)
        If activated (web.resource.js.minify = true and/or web.resource.css.minify = true) the given url is modified in order to target the minified version of js or css.
        Parameters:
        url - the url of js or css.
        Returns:
        if activated, the url of minified js or css resource, the given url otherwise.