org.exoplatform.social.common.xmlprocessor.filters
Class URLConverterFilterPlugin

java.lang.Object
  extended by org.exoplatform.container.component.BaseComponentPlugin
      extended by org.exoplatform.social.common.xmlprocessor.BaseXMLFilterPlugin
          extended by 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 => http://abc.com 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
URLConverterFilterPlugin(org.exoplatform.container.xml.InitParams params)
          Constructor with InitParams from container, if url.length > UrlMaxLength then the url display will be shorten.
URLConverterFilterPlugin(int urlMaxLength)
          Constructor with max length of URL, if url.length > UrlMaxLength then the url display will be shorten.
 
Method Summary
 Object doFilter(Object input)
          Filters the input data.
 int getUrlMaxLength()
          Gets max length of URL, if url.length > urlMaxLength and urlMaxLength >= 3 then the url display will be shorten
 void setUrlMaxLength(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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:
urlMaxLength -
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 -


Copyright © 2003–2014 eXo Platform SAS. All rights reserved.