Package org.javlo.helper
Class URLHelper
- java.lang.Object
-
- org.javlo.helper.ElementaryURLHelper
-
- org.javlo.helper.URLHelper
-
public class URLHelper extends ElementaryURLHelper
- Author:
- pvanderm
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.javlo.helper.ElementaryURLHelper
ElementaryURLHelper.Code
-
-
Field Summary
Fields Modifier and Type Field Description static String
ERROR_PREFIX
static String
MINETYPE_FOLDER
static String
REQUEST_MANAGER_PARAMATER_KEY
static String
TEMPLATE_RESOURCE_PREFIX
static String
VFS_SERVLET_NAME
-
Fields inherited from class org.javlo.helper.ElementaryURLHelper
BACK_PARAM_NAME, EXPCOMP, GLOBAL_CONTEXT_INSTANCE_ID_PARAM, IMG_SERVLET_PATH, RESOURCE_SERVLET_PATH, SPACIAL_RIGHT_CODE_KEY, TRANSFORM
-
-
Constructor Summary
Constructors Constructor Description URLHelper()
-
Method Summary
-
Methods inherited from class org.javlo.helper.ElementaryURLHelper
addAllParams, addCdn, addHost, addParam, addParams, addRawParam, addSpecialRightCode, createForwardURL, createJSPComponentURL, createNoProtocolURL, createSSLURL, createStaticComponentURL, createStaticURL, createStaticURL, createTeaserURL, createThumbURL, createTransformLongDescURL, createTransformURL, createTransformURL, createTransformURL, createTransformURL, createTransformURL, createTransformURL, createTransformURLWithoutCountAccess, createURL, extractParameterFromURL, getGravatarURL, getIconeURL, getParams, getParams, getParamsAsString, getPathPrefix, mergePath, removeParam, removeSite, removeStaticFolderPrefix, removeURI, resetPathPrefix
-
-
-
-
Field Detail
-
MINETYPE_FOLDER
public static final String MINETYPE_FOLDER
- See Also:
- Constant Field Values
-
REQUEST_MANAGER_PARAMATER_KEY
public static String REQUEST_MANAGER_PARAMATER_KEY
-
VFS_SERVLET_NAME
public static String VFS_SERVLET_NAME
-
TEMPLATE_RESOURCE_PREFIX
public static String TEMPLATE_RESOURCE_PREFIX
-
ERROR_PREFIX
public static final String ERROR_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
contains
public static boolean contains(Set<String> pathPatterns, String path, boolean trimStartSeparator)
-
getLogoUrl
public static String getLogoUrl(ContentContext ctx) throws Exception
- Throws:
Exception
-
getLogoUrl
public static String getLogoUrl(ContentContext ctx, String filter) throws Exception
- Throws:
Exception
-
getLogoRawUrl
public static String getLogoRawUrl(ContentContext ctx) throws Exception
- Throws:
Exception
-
createAbsoluteViewURL
public static String createAbsoluteViewURL(ContentContext ctx, String uri) throws Exception
- Throws:
Exception
-
createAjaxURL
public static String createAjaxURL(ContentContext ctx)
-
createAjaxURL
public static String createAjaxURL(ContentContext ctx, Map params)
-
createAjaxURL
public static String createAjaxURL(ContentContext ctx, String path)
-
createAjaxURL
public static String createAjaxURL(ContentContext ctx, String path, Map params)
-
createEditURL
public static String createEditURL(ContentContext ctx)
-
createEditURL
public static String createEditURL(String uri, ContentContext ctx) throws Exception
create a intern link URI to the page for edition- Parameters:
uri
- a standard urictx
- the current context of the content.- Returns:
- a URL
- Throws:
Exception
-
createGeneralResourceURL
public static String createGeneralResourceURL(ContentContext ctx, String url)
-
createOtherLanguageURL
public static String createOtherLanguageURL(ContentContext ctx, String lg)
-
createFileURL
public static String createFileURL(ContentContext ctx, String url, boolean hash)
-
createFileURL
public static String createFileURL(ContentContext ctx, String url)
-
createMediaURL
public static String createMediaURL(ContentContext ctx, MenuElement currentPage, String url)
-
createMediaURL
public static String createMediaURL(ContentContext ctx, String url)
-
createMediaURL
public static String createMediaURL(ContentContext ctx, String url, boolean hash)
-
createFileURL
public static String createFileURL(ContentContext ctx, MenuElement currentPage, String url)
-
createFileURL
public static String createFileURL(ContentContext ctx, MenuElement currentPage, String url, boolean hash)
-
createResourceURL
public static String createResourceURL(ContentContext ctx, MenuElement currentPage, String url)
-
createAvatarUrl
public static String createAvatarUrl(ContentContext ctx, IUserInfo userInfo)
-
createQRCodeLink
public static String createQRCodeLink(ContentContext ctx, IContentVisualComponent comp)
-
createExpCompLink
public static String createExpCompLink(ContentContext ctx, String compId)
-
createQRCodeLink
public static String createQRCodeLink(ContentContext ctx, String data)
-
createTransformURL
public static String createTransformURL(ContentContext ctx, File file, String filter) throws Exception
- Throws:
Exception
-
createResourceURL
@Deprecated public static String createResourceURL(ContentContext ctx, File file) throws IOException
Deprecated.- Throws:
IOException
-
createMediaURL
public static String createMediaURL(ContentContext ctx, File file) throws IOException
create a link to the file from media servlet- Parameters:
ctx
-file
-- Returns:
- Throws:
IOException
-
createFileURL
public static String createFileURL(ContentContext ctx, File file) throws IOException
- Throws:
IOException
-
createLocalURI
public static String createLocalURI(ContentContext ctx, File file)
-
createStaticFolderURI
public static String createStaticFolderURI(ContentContext ctx, File file)
-
createResourceURL
public static String createResourceURL(ContentContext ctx, String url)
-
createResourceURLWithoutAccessCount
public static String createResourceURLWithoutAccessCount(ContentContext ctx, String url)
-
createRSSURL
public static String createRSSURL(ContentContext ctx, String channel) throws Exception
- Throws:
Exception
-
createServletWrapperURL
public static String createServletWrapperURL(ContentContext ctx, String url, String paramName)
-
createSSLURL
public static final String createSSLURL(ContentContext ctx)
-
createStaticFeedbackURL
public static String createStaticFeedbackURL(ContentContext ctx, String data)
-
createStaticResourceURL
public static String createStaticResourceURL(ContentContext ctx, String url)
-
createStaticSharedResourceURL
public static String createStaticSharedResourceURL(ContentContext ctx, String url)
-
createTemplateResourceURL
public static String createTemplateResourceURL(ContentContext ctx, String url)
-
createStaticTemplateURL
public static String createStaticTemplateURL(ContentContext ctx, String url) throws Exception
- Throws:
Exception
-
createStaticTemplatePath
public static String createStaticTemplatePath(ContentContext ctx, String url, String templateVersion) throws Exception
- Throws:
Exception
-
createStaticTemplateURL
public static String createStaticTemplateURL(ContentContext ctx, String url, String templateVersion) throws Exception
- Throws:
Exception
-
createStaticTemplateURL
protected static String createStaticTemplateURL(ContentContext ctx, String url, String templateVersion, boolean widthPath) throws Exception
- Throws:
Exception
-
createStaticTemplatePluginURL
public static String createStaticTemplatePluginURL(ContentContext ctx, String url, String pluginFolder) throws Exception
- Throws:
Exception
-
createActionURL
public static String createActionURL(ContentContext ctx, String action)
-
createActionURL
public static String createActionURL(ContentContext ctx, String action, String inUrl)
-
createStaticURL
public static String createStaticURL(ContentContext ctx, MenuElement referencePage, String inUrl)
-
createAbsoluteURL
public static String createAbsoluteURL(ContentContext ctx, String inUrl)
-
createStaticTemplateURL
public static String createStaticTemplateURL(ContentContext ctx, Template template, String url) throws Exception
- Throws:
Exception
-
createStaticTemplateURLWithoutContext
public static String createStaticTemplateURLWithoutContext(ContentContext ctx, Template template, String url) throws Exception
- Throws:
Exception
-
createTemplateSourceURL
public static String createTemplateSourceURL(ContentContext ctx, String url)
-
createTransformStaticTemplateURL
public static String createTransformStaticTemplateURL(ContentContext ctx, Template template, String filter, String url) throws Exception
- Throws:
Exception
-
createTransformLocalTemplateURL
public static String createTransformLocalTemplateURL(ContentContext ctx, String template, String filter, String url) throws Exception
- Throws:
Exception
-
createURL
public static String createURL(ContentContext ctx)
-
createVirtualURL
public static String createVirtualURL(ContentContext ctx)
-
createDataDocumentURL
public static String createDataDocumentURL(ContentContext ctx, DataDocument doc, String url)
transform document data to param for url- Parameters:
ctx
-category
- the category of the documentid
-url
-- Returns:
-
createURLWithoutURLFacotry
public static String createURLWithoutURLFacotry(ContentContext ctx, String path)
-
createPDFURL
public static String createPDFURL(ContentContext ctx)
-
createLocalURL
public static String createLocalURL(ContentContext ctx)
create URL without context.- Parameters:
ctx
-- Returns:
-
createURL
public static String createURL(ContentContext ctx, Map params)
-
createURL
public static String createURL(ContentContext ctx, MenuElement page, Map params)
-
createURL
public static String createURL(ContentContext ctx, MenuElement page)
-
addSuffix
public static String addSuffix(String URL, String suffix)
add suffix to the URL. sample (suffix: #suffix) : www.javlo.org >> www.javlo.org#suffix sample 2 (suffix: #suffix) : www.javlo.org?test=test >> www.javlo.org#suffix?test=test- Parameters:
URL
-suffix
-- Returns:
-
createURL
public static String createURL(ContentContext ctx, String uri)
create a intern link URL- Parameters:
uri
- the target urictx
- the current context of the content.- Returns:
- a URL
-
createURLWithServletPath
public static String createURLWithServletPath(ContentContext ctx, String servletPath, String uri)
-
createLocalURLWithtoutEncodeURL
public static String createLocalURLWithtoutEncodeURL(ContentContext ctx, String uri)
create url without context and without encoreURL (remove jsessionid)- Parameters:
ctx
-uri
-- Returns:
-
createURLWithtoutEncodeURL
public static String createURLWithtoutEncodeURL(ContentContext ctx, String uri)
-
createURLWithtoutContext
public static String createURLWithtoutContext(ContentContext ctx, String uri)
-
createURL
public static String createURL(ContentContext ctx, GlobalContext globalContext, String uri)
-
createURL
public static String createURL(ContentContext ctx, String path, Map params)
-
createStaticFileUrl
public static String createStaticFileUrl(ContentContext ctx, File file)
-
createStaticURL
public static String createStaticURL(ContentContext ctx, String path, Map params)
-
createURL
public static String createURL(ContentContext ctx, String uri, String lg)
create a url but change the lg- Parameters:
ctx
-uri
-lg
-- Returns:
-
createURL
public static String createURL(ContentContext ctx, String[] recupParam, Map params)
-
createURL
@Deprecated public static String createURL(String uri, ContentContext ctx)
Deprecated.switch parameters
-
createURLCheckLg
public static String createURLCheckLg(ContentContext ctx, String uri)
create a url but check if url start with a lg ref.- Parameters:
ctx
-uri
- the uri (can start with lg ref.)- Returns:
-
createURLFromPageName
public static String createURLFromPageName(ContentContext ctx, String pageName, Map<String,String> params) throws Exception
- Throws:
Exception
-
createURLFromPageName
public static String createURLFromPageName(ContentContext ctx, String pageName) throws Exception
- Throws:
Exception
-
createURLNoForceTemplate
public static String createURLNoForceTemplate(ContentContext ctx)
-
createURLNoPathPrefix
public static String createURLNoPathPrefix(ContentContext ctx, String uri)
create a intern link URL without context path- Parameters:
uri
- the target urictx
- the current context of the content.- Returns:
- a URL
-
createVFSURL
public static String createVFSURL(ContentContext ctx, String dataFile, String uri)
create the url to a file in to a virtual file system (sp. zip file)- Parameters:
dataFile
- the date file (sp. zip file)uri
- the uri in virtual file- Returns:
- a full url to uri
-
createViewURL
public static String createViewURL(String uri, ContentContext ctx) throws Exception
create a intern link URI to the view site- Parameters:
uri
- a standard urictx
- the current context of the content.- Returns:
- a URL
- Throws:
Exception
-
createVisualTemplateURL
public static String createVisualTemplateURL(ContentContext ctx, Template template, String filter) throws Exception
- Throws:
Exception
-
cryptURL
public static String cryptURL(ContentContext ctx, String url) throws Exception
transform a url to a crypted param url. sampe : http://www.cms.com?id=342&user=patrick --> http://www.cms.com?crypted_param=sl4ZDC74DR5673DT5- Parameters:
ctx
- current content context.url
- a url (with parameters)- Returns:
- Throws:
Exception
-
extractName
public static String extractName(String url)
extract a host name from a url- Parameters:
url
- a url sample : http://www.host.ext/view/fr/test.html (extract name : host)- Returns:
- return a name (hostname without last extension)
-
getMoveChildURL
public static String getMoveChildURL(ContentContext ctx, MenuElement elem)
-
getMoveParentURL
public static String getMoveParentURL(ContentContext ctx, MenuElement elem)
-
createInterModuleURL
public static String createInterModuleURL(ContentContext ctx, String url, String moduleName) throws Exception
create a special URL to call a other module.- Parameters:
url
-moduleName
-- Returns:
- Throws:
Exception
-
createInterModuleURL
public static String createInterModuleURL(ContentContext ctx, String url, String moduleName, Map<String,String> inParams) throws Exception
create a special URL to call a other module.- Parameters:
url
-moduleName
-- Returns:
- Throws:
Exception
-
createInterModuleURL
public static String createInterModuleURL(ContentContext ctx, String url, String moduleName, String fromModule, Map<String,String> inParams) throws Exception
- Throws:
Exception
-
createModuleURL
public static String createModuleURL(ContentContext ctx, String url, String moduleName)
create a special URL to activate a module.
-
createModuleURL
public static String createModuleURL(ContentContext ctx, String url, String moduleName, Map<String,String> inParams)
create a special URL to activate a module.
-
isAbsoluteURL
public static boolean isAbsoluteURL(String url)
-
isJavascriptLink
public static boolean isJavascriptLink(String link)
-
removeFirstSlash
public static String removeFirstSlash(String path)
remove first / on a path if exist- Parameters:
path
-- Returns:
- the same string if not start width / and the string without first / (all first /)
-
_changeMode
public static final String _changeMode(String inURL, String mode) throws MalformedURLException
- Throws:
MalformedURLException
-
changeMode
public static final String changeMode(String inURL, String mode) throws MalformedURLException
- Throws:
MalformedURLException
-
getParentURL
public static String getParentURL(String url)
get the parent url of a url. sample: http://www.javlo.org/static/images/visual.png >> http://www.javlo.org/static/images- Parameters:
url
-- Returns:
- a url to a folder.
-
replaceFolderVariable
public static String replaceFolderVariable(ContentContext ctx, String url)
-
smartLink
public static String smartLink(ContentContext ctx, String link) throws Exception
transform text to url. if absolute url >> return same link, if contains '/' >> search on path, don't contains '/' >> search as page name.- Parameters:
ctx
-link
-- Returns:
- Throws:
Exception
-
addMailingFeedback
public static String addMailingFeedback(ContentContext ctx, String url)
-
addCredential
public static String addCredential(String url, String login, String password)
transform url with credential. semple : http://www.javlo.be >> http://login:password@www.javlo.be- Parameters:
url
-login
-password
-- Returns:
-
getFileURL
public static String getFileURL(ContentContext ctx, File file)
-
createProxyURL
public static String createProxyURL(ContentContext ctx, String inURL) throws MalformedURLException
- Throws:
MalformedURLException
-
createProxyURL
public static String createProxyURL(String rootURL, String inURL) throws MalformedURLException
- Throws:
MalformedURLException
-
getFileTypeURL
public static String getFileTypeURL(ContentContext ctx, File file)
-
replacePageReference
public static String replacePageReference(ContentContext ctx, String text) throws Exception
replace page:pagename with the correct link to the page.- Parameters:
text
-- Returns:
- Throws:
Exception
-
getSep
public static final String getSep(String url)
if url contains ? return & else return ?- Parameters:
url
-- Returns:
-
isCorrectJavloLink
public static boolean isCorrectJavloLink(String link)
-
convertLink
public static String convertLink(ContentContext ctx, String link) throws Exception
convert external link if start with page: or / to internet link or relative link.- Parameters:
ctx
-link
-- Returns:
- Throws:
Exception
-
main
public static void main(String[] args)
-
createNoImageUrl
public static String createNoImageUrl(ContentContext ctx, String filter) throws Exception
- Throws:
Exception
-
-