org.apache.directory.api.ldap.model.filter
Class FilterEncoder

java.lang.Object
  extended by org.apache.directory.api.ldap.model.filter.FilterEncoder

public class FilterEncoder
extends Object

An encoder for LDAP filters.

Author:
Apache Directory Project

Constructor Summary
FilterEncoder()
           
 
Method Summary
static String encodeFilterValue(String value)
          Handles encoding of special characters in LDAP search filter assertion values using the <valueencoding> rule as described in RFC 4515.
static String format(String filterTemplate, String[] values)
          Formats a filter and handles encoding of special characters in the value arguments using the <valueencoding> rule as described in RFC 4515.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterEncoder

public FilterEncoder()
Method Detail

format

public static String format(String filterTemplate,
                            String[] values)
                     throws IllegalArgumentException
Formats a filter and handles encoding of special characters in the value arguments using the <valueencoding> rule as described in RFC 4515.

Example of filter template format: (&(cn={0})(uid={1}))

Parameters:
filterTemplate - the filter with placeholders
values - the values to encode and substitute
Returns:
the formatted filter with escaped values
Throws:
IllegalArgumentException - if the number of values does not match the number of placeholders in the template

encodeFilterValue

public static String encodeFilterValue(String value)
Handles encoding of special characters in LDAP search filter assertion values using the <valueencoding> rule as described in RFC 4515.

Parameters:
value - Right hand side of "attrId=value" assertion occurring in an LDAP search filter.
Returns:
Escaped version of value


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.