Package org.silverpeas.core.util
Class URLUtil
- java.lang.Object
-
- org.silverpeas.core.util.URLUtil
-
public class URLUtil extends Object
Class declaration- Author:
- t.leroi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
URLUtil.Permalink
-
Field Summary
-
Constructor Summary
Constructors Constructor Description URLUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
addFingerprintVersionOn(String url)
static boolean
displayUniversalLinks()
static String
encodeURL(String url)
Translates a string intoapplication/x-www-form-urlencoded
format using a specific encoding scheme.static String
getAbsoluteApplicationURL()
Gets the absolute application URL when the treatment is executed into the context of a HTTP request.static String
getAbsoluteLocalApplicationURL()
Gets the absolute local application URL when the treatment is executed into the context of a HTTP request.static String
getApplicationURL()
Returns The Application web context.static String
getComponentInstanceURL(String sComponentId)
static String
getCurrentLocalServerURL()
static String
getCurrentServerURL()
static String
getFullApplicationURL(javax.servlet.http.HttpServletRequest request)
static String
getHttpMode()
static String
getLocalServerURL(javax.servlet.http.HttpServletRequest request)
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.static String
getNewComponentURL(String spaceId, String componentId)
Retourne l'URL pour les nouveaux composants lors de la recherche globalestatic String
getPermalink(URLUtil.Permalink permalink, String resourceId)
Gets the permalink according to the specified parameters.static String
getSearchResultURL(Contribution content)
static String
getServerURL(javax.servlet.http.HttpServletRequest request)
static String
getSilverpeasFingerprint()
static String
getSilverpeasVersion()
static String
getSimpleURL(int type, String id)
static String
getSimpleURL(int type, String id, boolean appendContext)
static String
getSimpleURL(int type, String id, String componentId)
static String
getSimpleURL(int type, String id, String componentId, boolean appendContext)
static String
getSimpleURL(int type, String id, String componentId, boolean appendContext, String forumId)
static String
getURL(String sComponentName)
Deprecated.static String
getURL(String sSpace, String sComponentId)
static String
getURL(String sComponentName, String sSpace, String sComponentId)
static boolean
isPermalink(String url)
static void
setCurrentServerUrl(javax.servlet.http.HttpServletRequest request)
static void
setSilverpeasVersion(String version)
-
-
-
Field Detail
-
CMP_AGENDA
public static final String CMP_AGENDA
- See Also:
- Constant Field Values
-
CMP_SILVERMAIL
public static final String CMP_SILVERMAIL
- See Also:
- Constant Field Values
-
CMP_POPUP
public static final String CMP_POPUP
- See Also:
- Constant Field Values
-
CMP_PERSONALIZATION
public static final String CMP_PERSONALIZATION
- See Also:
- Constant Field Values
-
CMP_TODO
public static final String CMP_TODO
- See Also:
- Constant Field Values
-
CMP_SCHEDULE_EVENT
public static final String CMP_SCHEDULE_EVENT
- See Also:
- Constant Field Values
-
CMP_CLIPBOARD
public static final String CMP_CLIPBOARD
- See Also:
- Constant Field Values
-
CMP_NOTIFICATIONUSER
public static final String CMP_NOTIFICATIONUSER
- See Also:
- Constant Field Values
-
CMP_JOBMANAGERPEAS
public static final String CMP_JOBMANAGERPEAS
- See Also:
- Constant Field Values
-
CMP_JOBDOMAINPEAS
public static final String CMP_JOBDOMAINPEAS
- See Also:
- Constant Field Values
-
CMP_JOBSTARTPAGEPEAS
public static final String CMP_JOBSTARTPAGEPEAS
- See Also:
- Constant Field Values
-
CMP_JOBSEARCHPEAS
public static final String CMP_JOBSEARCHPEAS
- See Also:
- Constant Field Values
-
CMP_SILVERSTATISTICSPEAS
public static final String CMP_SILVERSTATISTICSPEAS
- See Also:
- Constant Field Values
-
CMP_PDC
public static final String CMP_PDC
- See Also:
- Constant Field Values
-
CMP_THESAURUS
public static final String CMP_THESAURUS
- See Also:
- Constant Field Values
-
CMP_INTERESTCENTERPEAS
public static final String CMP_INTERESTCENTERPEAS
- See Also:
- Constant Field Values
-
CMP_MYLINKSPEAS
public static final String CMP_MYLINKSPEAS
- See Also:
- Constant Field Values
-
CMP_PDCSUBSCRIPTION
public static final String CMP_PDCSUBSCRIPTION
- See Also:
- Constant Field Values
-
CMP_VERSIONINGPEAS
public static final String CMP_VERSIONINGPEAS
- See Also:
- Constant Field Values
-
CMP_FILESHARING
public static final String CMP_FILESHARING
- See Also:
- Constant Field Values
-
CMP_WEBCONNECTIONS
public static final String CMP_WEBCONNECTIONS
- See Also:
- Constant Field Values
-
CMP_JOBBACKUP
public static final String CMP_JOBBACKUP
- See Also:
- Constant Field Values
-
CMP_TEMPLATEDESIGNER
public static final String CMP_TEMPLATEDESIGNER
- See Also:
- Constant Field Values
-
CMP_MYPROFILE
public static final String CMP_MYPROFILE
- See Also:
- Constant Field Values
-
URL_SPACE
public static final int URL_SPACE
- See Also:
- Constant Field Values
-
URL_COMPONENT
public static final int URL_COMPONENT
- See Also:
- Constant Field Values
-
URL_PUBLI
public static final int URL_PUBLI
- See Also:
- Constant Field Values
-
URL_TOPIC
public static final int URL_TOPIC
- See Also:
- Constant Field Values
-
URL_FILE
public static final int URL_FILE
- See Also:
- Constant Field Values
-
URL_SURVEY
public static final int URL_SURVEY
- See Also:
- Constant Field Values
-
URL_QUESTION
public static final int URL_QUESTION
- See Also:
- Constant Field Values
-
URL_MESSAGE
public static final int URL_MESSAGE
- See Also:
- Constant Field Values
-
URL_DOCUMENT
public static final int URL_DOCUMENT
- See Also:
- Constant Field Values
-
URL_VERSION
public static final int URL_VERSION
- See Also:
- Constant Field Values
-
URL_MEDIA
public static final int URL_MEDIA
- See Also:
- Constant Field Values
-
URL_NEWSLETTER
public static final int URL_NEWSLETTER
- See Also:
- Constant Field Values
-
-
Method Detail
-
getURL
public static String getURL(String sComponentName, String sSpace, String sComponentId)
- Parameters:
sComponentName
- - the componentName (ie kmelia, bookmark...)sSpace
- - the space idsComponentId
- - 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.
-
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, boolean appendContext, String forumId)
-
getSimpleURL
public static String getSimpleURL(int type, String id, String componentId, boolean appendContext)
-
getSearchResultURL
public static String getSearchResultURL(Contribution content)
-
encodeURL
public static String encodeURL(String url)
Translates a string intoapplication/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()
-
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.
-
-