Class URLConverterFilterPlugin
- java.lang.Object
-
- org.exoplatform.container.component.BaseComponentPlugin
-
- org.exoplatform.social.common.xmlprocessor.BaseXMLFilterPlugin
-
- org.exoplatform.social.common.xmlprocessor.filters.URLConverterFilterPlugin
-
- All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin,Filter
public class URLConverterFilterPlugin extends BaseXMLFilterPlugin
This URLConverterFilterPlugin is a plugin for XMLProcessor which will auto convert any detected text link into real links, for example: http://abc.com => <a href="http://abc.com" title="http://abc.com">http://abc.com</a> Moreover, this plugin can trim any link to a fix size when it's too long by specifying the urlMaxLength via init params. the urlMaxLength = url.length() + "...".length(), if urlMaxLength less than 3 the filter will no trim the url for display.- Since:
- 1.2.2
- Author:
- Ly Minh Phuong - http://phuonglm.net
-
-
Constructor Summary
Constructors Constructor Description URLConverterFilterPlugin(int urlMaxLength)Constructor with max length of URL, if url.length > UrlMaxLength then the url display will be shorten.URLConverterFilterPlugin(org.exoplatform.container.xml.InitParams params)Constructor with InitParams from container, if url.length > UrlMaxLength then the url display will be shorten.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectdoFilter(Object input)Filters the input data.intgetUrlMaxLength()Gets max length of URL, if url.length > urlMaxLength and urlMaxLength >= 3 then the url display will be shortenvoidsetUrlMaxLength(int urlMaxLength)Sets max length of URL, if url.length > urlMaxLength and urlMaxLength >= 3 then the url display will be shorten.
-
-
-
Constructor Detail
-
URLConverterFilterPlugin
public URLConverterFilterPlugin(int urlMaxLength)
Constructor with max length of URL, if url.length > UrlMaxLength then the url display will be shorten.- Parameters:
urlMaxLength-
-
URLConverterFilterPlugin
public URLConverterFilterPlugin(org.exoplatform.container.xml.InitParams params)
Constructor with InitParams from container, if url.length > UrlMaxLength then the url display will be shorten.- Parameters:
params-
-
-
Method Detail
-
doFilter
public Object doFilter(Object input)
Filters the input data.- Parameters:
input- the input data- Returns:
- an Object with the result after filtered
-
getUrlMaxLength
public int getUrlMaxLength()
Gets max length of URL, if url.length > urlMaxLength and urlMaxLength >= 3 then the url display will be shorten- Returns:
-
setUrlMaxLength
public void setUrlMaxLength(int urlMaxLength)
Sets max length of URL, if url.length > urlMaxLength and urlMaxLength >= 3 then the url display will be shorten.- Parameters:
urlMaxLength-
-
-