com.raritantechnologies.utils.filter
Class URLContentFilter

java.lang.Object
  extended bycom.raritantechnologies.utils.filter.URLContentFilter
All Implemented Interfaces:
IConfigurable, IStringFilter

public class URLContentFilter
extends java.lang.Object
implements IStringFilter

Replaces a URL String with the contents of the URL. Handles http URLs and file URLs.

XML Configuration Template:
   <StringFilter class="com.raritantechnologies.utils.filter.URLContentFilter"
                    useURLSocket="true|false(default)"
                    stringIsFileName="[ true|false(default) - use if string is local file ]"
                    requestMethod="get(default)|post"
                    proxyHost="[ http proxy host ]"
                    proxyPort="[ http proxy port ]"
                    proxyUser="[ user name for proxy host ]"
                    proxyPassword="[ password for proxy host ]"
                    debugTiming="[ true|false(default) ]" 
                    textFileTypes="[ optional list of file extensions that should be treated as text files ]" >

     <!-- ============================================================================ -->
     <!-- One or more (optional) IStreamFilter classes to convert mime types to String -->
     <!-- ============================================================================ -->
     <StreamFilter contentType="[ content type that this filter handles ]"
                      class="[ class of com.raritantechnologies.utils.filter.IStreamFilter ]" >

     </StreamFilter>

   </StringFilter>                    
 

If useURLSocket configuration attribute is true - uses the RTI GetURLSocket class, else uses the standard Java URLConnection which is the default.
Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Field Summary
 
Fields inherited from interface com.raritantechnologies.utils.filter.IStringFilter
TEMPLATE
 
Constructor Summary
URLContentFilter()
           
 
Method Summary
 java.lang.String filterString(java.util.Map parameters, java.lang.String inputString)
           
 java.lang.String filterString(java.lang.String inputString)
           
 java.lang.String filterString(java.lang.String sessionID, java.lang.String pUrlStr)
           
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 void getConfigurationXML(java.io.Writer writer)
           
 OrderedMap getCookies()
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void setAuthentication(java.lang.String username, java.lang.String password)
           
 void setCookies(OrderedMap cookies)
           
 void setProxyAuthentication(java.lang.String username, java.lang.String password)
           
 void setProxyHost(java.lang.String proxyHost)
           
 void setProxyPort(java.lang.String proxyPort)
           
 void setProxyServerMap(ProxyServerMap proxyMap)
           
 void setUseGetURL(boolean useGetURLSocket)
           
 void setUseURLSocket(boolean useURLSocket)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLContentFilter

public URLContentFilter()
Method Detail

filterString

public java.lang.String filterString(java.lang.String inputString)
Specified by:
filterString in interface IStringFilter

filterString

public java.lang.String filterString(java.util.Map parameters,
                                     java.lang.String inputString)
Specified by:
filterString in interface IStringFilter

filterString

public java.lang.String filterString(java.lang.String sessionID,
                                     java.lang.String pUrlStr)
Specified by:
filterString in interface IStringFilter

setUseURLSocket

public void setUseURLSocket(boolean useURLSocket)

setUseGetURL

public void setUseGetURL(boolean useGetURLSocket)

setProxyHost

public void setProxyHost(java.lang.String proxyHost)

setProxyPort

public void setProxyPort(java.lang.String proxyPort)

setProxyAuthentication

public void setProxyAuthentication(java.lang.String username,
                                   java.lang.String password)

setAuthentication

public void setAuthentication(java.lang.String username,
                              java.lang.String password)

setProxyServerMap

public void setProxyServerMap(ProxyServerMap proxyMap)

setCookies

public void setCookies(OrderedMap cookies)

getCookies

public OrderedMap getCookies()

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

getConfigurationXML

public void getConfigurationXML(java.io.Writer writer)
                         throws java.io.IOException
Throws:
java.io.IOException

getConfigurationXML

public java.lang.String getConfigurationXML()
Specified by:
getConfigurationXML in interface IStringFilter

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
Specified by:
getConfigurationXML in interface IStringFilter