Package org.javlo.helper
Class ElementaryURLHelper
- java.lang.Object
-
- org.javlo.helper.ElementaryURLHelper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ElementaryURLHelper.Code
-
Field Summary
Fields Modifier and Type Field Description static String
BACK_PARAM_NAME
static String
EXPCOMP
static String
GLOBAL_CONTEXT_INSTANCE_ID_PARAM
static String
IMG_SERVLET_PATH
static String
RESOURCE_SERVLET_PATH
static String
SPACIAL_RIGHT_CODE_KEY
static String
TRANSFORM
-
Constructor Summary
Constructors Constructor Description ElementaryURLHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
addAllParams(String url, String... params)
add get attribute to a url.static String
addCdn(ContentContext ctx, String url)
protected static String
addHost(ContentContext ctx, String url)
static String
addParam(String url, String name, String value)
static String
addParams(String url, String params)
static String
addRawParam(String url, String name, String value)
static String
addSpecialRightCode(GlobalContext globalContext, javax.servlet.http.HttpSession session, String url)
static String
createAbsoluteURL(ContentContext ctx, String uri)
static String
createForwardURL(ContentContext ctx, String url)
remove context from url if exist.static String
createJSPComponentURL(javax.servlet.http.HttpServletRequest request, String url, String componentType)
protected static String
createNoProtocolURL(ContentContext ctx, GlobalContext globalContext, String servletPath, String uri, boolean ajax, boolean withPathPrefix, boolean widthEncodeURL)
static String
createSSLURL(String uri, ContentContext ctx)
static String
createStaticComponentURL(javax.servlet.http.HttpServletRequest request, String url, String componentType)
static String
createStaticURL(ContentContext ctx, String inUrl)
protected static String
createStaticURL(ContentContext ctx, MenuElement referencePage, String inUrl, boolean withPathPrefix)
static String
createTeaserURL(ContentContext ctx, String url)
static String
createThumbURL(ContentContext ctx, String url, int width, boolean ts)
static String
createTransformLongDescURL(ContentContext ctx, String url)
static String
createTransformURL(ContentContext ctx, String url, String filter)
static String
createTransformURL(ContentContext ctx, MenuElement referencePage, String url, String filter)
static String
createTransformURL(ContentContext ctx, MenuElement referencePage, String url, String filter, String templateName)
static String
createTransformURL(ContentContext ctx, MenuElement referencePage, Template template, String url, String filter)
static String
createTransformURL(ContentContext ctx, MenuElement referencePage, Template template, String url, String filter, IImageFilter comp)
static String
createTransformURL(ContentContext ctx, StaticInfo info, String filter)
static String
createTransformURLWithoutCountAccess(ContentContext ctx, String url, String filter)
protected static String
createURL(ContentContext ctx, GlobalContext globalContext, String servletUri, String uri, boolean ajax, boolean forceTemplate, boolean withPathPrefix, boolean widthEncodeURL)
static Map<String,String>
extractParameterFromURL(String url)
static URL
getGravatarURL(String email, String alternativeURL)
creata a URL to gravatar of email, alternativeURL is the url use if no avatar registered on gravatar.static String
getIconeURL(ContentContext ctx, String icone)
static Map<String,String>
getParams(String url)
static Map<String,String>
getParams(URL url)
static String
getParamsAsString(String url)
static String
getPathPrefix(ContentContext ctx)
return the path path prefix defined in ServletContextstatic void
main(String[] args)
return the path path prefix defined in ServletContextstatic String
mergePath(String path1, String path2)
merge the path. sample mergePath ("/cat", "element" ) -> /cat/element, mergePath ("/test/", "/google) -> /test/googlestatic String
removeParam(String url)
remove param. test.html?static String
removeSite(ContentContext ctx, String url)
static String
removeStaticFolderPrefix(ContentContext ctx, String path)
remove static folder at the start of the path.static String
removeURI(String inURL)
static void
resetPathPrefix(ContentContext ctx)
-
-
-
Field Detail
-
EXPCOMP
public static final String EXPCOMP
- See Also:
- Constant Field Values
-
GLOBAL_CONTEXT_INSTANCE_ID_PARAM
public static final String GLOBAL_CONTEXT_INSTANCE_ID_PARAM
- See Also:
- Constant Field Values
-
TRANSFORM
public static final String TRANSFORM
- See Also:
- Constant Field Values
-
SPACIAL_RIGHT_CODE_KEY
public static final String SPACIAL_RIGHT_CODE_KEY
- See Also:
- Constant Field Values
-
BACK_PARAM_NAME
public static final String BACK_PARAM_NAME
- See Also:
- Constant Field Values
-
IMG_SERVLET_PATH
public static final String IMG_SERVLET_PATH
- See Also:
- Constant Field Values
-
RESOURCE_SERVLET_PATH
public static final String RESOURCE_SERVLET_PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
addAllParams
public static String addAllParams(String url, String... params)
add get attribute to a url.- Parameters:
params
- a list of string represent param and value. (sp: name=patrick).- Returns:
- a url with new params
-
addSpecialRightCode
public static final String addSpecialRightCode(GlobalContext globalContext, javax.servlet.http.HttpSession session, String url)
-
createAbsoluteURL
public static String createAbsoluteURL(ContentContext ctx, String uri)
-
createJSPComponentURL
public static String createJSPComponentURL(javax.servlet.http.HttpServletRequest request, String url, String componentType)
-
createNoProtocolURL
protected static final String createNoProtocolURL(ContentContext ctx, GlobalContext globalContext, String servletPath, String uri, boolean ajax, boolean withPathPrefix, boolean widthEncodeURL)
-
createSSLURL
public static final String createSSLURL(String uri, ContentContext ctx)
-
createStaticComponentURL
public static String createStaticComponentURL(javax.servlet.http.HttpServletRequest request, String url, String componentType)
-
createStaticURL
protected static String createStaticURL(ContentContext ctx, MenuElement referencePage, String inUrl, boolean withPathPrefix)
-
createStaticURL
public static String createStaticURL(ContentContext ctx, String inUrl)
-
createTeaserURL
public static String createTeaserURL(ContentContext ctx, String url)
-
createThumbURL
public static String createThumbURL(ContentContext ctx, String url, int width, boolean ts)
-
createTransformLongDescURL
public static String createTransformLongDescURL(ContentContext ctx, String url) throws Exception
- Throws:
Exception
-
createTransformURL
public static String createTransformURL(ContentContext ctx, MenuElement referencePage, Template template, String url, String filter) throws Exception
- Throws:
Exception
-
createTransformURL
public static String createTransformURL(ContentContext ctx, MenuElement referencePage, Template template, String url, String filter, IImageFilter comp) throws Exception
- Throws:
Exception
-
createTransformURL
public static String createTransformURL(ContentContext ctx, MenuElement referencePage, String url, String filter) throws Exception
- Throws:
Exception
-
createTransformURL
public static String createTransformURL(ContentContext ctx, MenuElement referencePage, String url, String filter, String templateName) throws Exception
- Throws:
Exception
-
addCdn
public static String addCdn(ContentContext ctx, String url)
-
createTransformURL
public static String createTransformURL(ContentContext ctx, String url, String filter) throws Exception
- Throws:
Exception
-
createTransformURL
public static String createTransformURL(ContentContext ctx, StaticInfo info, String filter) throws Exception
- Throws:
Exception
-
createTransformURLWithoutCountAccess
public static String createTransformURLWithoutCountAccess(ContentContext ctx, String url, String filter) throws Exception
- Throws:
Exception
-
createURL
protected static String createURL(ContentContext ctx, GlobalContext globalContext, String servletUri, String uri, boolean ajax, boolean forceTemplate, boolean withPathPrefix, boolean widthEncodeURL)
-
addHost
protected static String addHost(ContentContext ctx, String url)
-
getIconeURL
public static String getIconeURL(ContentContext ctx, String icone)
-
getPathPrefix
public static String getPathPrefix(ContentContext ctx)
return the path path prefix defined in ServletContext- Parameters:
request
-- Returns:
-
resetPathPrefix
public static void resetPathPrefix(ContentContext ctx)
-
main
public static void main(String[] args)
return the path path prefix defined in ServletContext- Parameters:
request
-
-
removeParam
public static final String removeParam(String url)
remove param. test.html?p=1 >> test.html- Parameters:
url
-- Returns:
-
removeSite
public static final String removeSite(ContentContext ctx, String url)
-
mergePath
public static String mergePath(String path1, String path2)
merge the path. sample mergePath ("/cat", "element" ) -> /cat/element, mergePath ("/test/", "/google) -> /test/google- Parameters:
path1
-path2
-- Returns:
-
createForwardURL
public static String createForwardURL(ContentContext ctx, String url)
remove context from url if exist.- Parameters:
ctx
-url
-- Returns:
-
getGravatarURL
public static URL getGravatarURL(String email, String alternativeURL) throws MalformedURLException
creata a URL to gravatar of email, alternativeURL is the url use if no avatar registered on gravatar.- Parameters:
email
-alternativeURL
-- Returns:
- Throws:
MalformedURLException
-
removeStaticFolderPrefix
public static String removeStaticFolderPrefix(ContentContext ctx, String path)
remove static folder at the start of the path.
-
removeURI
public static String removeURI(String inURL) throws MalformedURLException
- Throws:
MalformedURLException
-
-