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
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
-
Field Summary
Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin
desc, name -
Constructor Summary
ConstructorsConstructorDescriptionURLConverterFilterPlugin(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
Modifier and TypeMethodDescriptionFilters the input data.intGets 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.Methods inherited from class org.exoplatform.container.component.BaseComponentPlugin
getDescription, getName, setDescription, setName
-
Constructor Details
-
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 Details
-
doFilter
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-
-