Nitido Inc.

com.nitido.nimbox.http.enhanced
Class RulesHandler

java.lang.Object
  extended by com.nitido.nimbox.http.enhanced.RulesHandler
All Implemented Interfaces:
EnhancedDispatcherConstants, org.xml.sax.ErrorHandler

public class RulesHandler
extends java.lang.Object
implements EnhancedDispatcherConstants, org.xml.sax.ErrorHandler

Parses the rules from a rule file defined in configuration and returns the skin type for matched rule. The rule files must follow a given XML schema (rules.xsd) in order to be "translated" by Rule Handler. If I have "IS" rule with one expression, and a matching User-Agent header is found in the request the results are being cached. Sample of "IS" rule User-Agent is My matching UA string markup html markupversion 4.0 If the value for the User-Agent header from the request is "My matching UA string" then this String is cached. Next time when this User Agent is encountered the results are being retrieved from cache using User-Agent as key.

For more details, see the definition file "rules.xsd".


Field Summary
 
Fields inherited from interface com.nitido.nimbox.http.enhanced.EnhancedDispatcherConstants
ACCEPT, ALLOF, ANYOF, CONF_KEY_DEFAULT_LOCALE, CONF_KEY_DEFAULT_SKIN_TYPE, CONF_KEY_LOCALE_KEYS, CONF_KEY_RULES_LOCATION, CONF_KEY_SKIN_PATH_LAYOUT, CONF_KEY_WEB_PATCH_WURFL_URL, CONF_KEY_WURFL_URL, CONTAINS, DEFAULT_SKIN_TYPE, DOM_NODE_PROP, EXTERNAL_NONAMESPACE_SCHEMA_LOCATION_PROP, GENERIC_DEVICE_ID, HTML_VER_3_2, HTML_VER_4_0, IF, IF_CONDITIONAL, IHTML_VER_1_0, IHTML_VER_2_0, IHTML_VER_3_0, IHTML_VER_4_0, IHTML_VER_5_0, IS, IXHTML_VER_1_0, KEY_CLIENT_PROFILE, KEY_LOCALE, LOCALE_EN, MARKUP_TYPE, MARKUP_VERSION_TYPE, NAMESPACE_PREFIXES_FEATURE, SCHEMA_FULL_CHECKING_FEATURE, SCHEMA_VALIDATION_FEATURE, STARTS_WITH, TAG_CONDITION, TAG_EXPRESSION, TAG_HTTP_HEADER, TAG_MATCH_HOLDER, TAG_RELATION, TAG_RESULT, TAG_RESULT_TYPE, TAG_RESULT_VALUE, TAG_RULE, USER_AGENT, VALIDATION_FEATURE, WML_VER_1_1, WML_VER_1_2, WML_VER_1_3, WURFL_KEY_COLUMNS, WURFL_KEY_MAX_DECK_SIZE, WURFL_KEY_MAX_IMAGE_HEIGHT, WURFL_KEY_MAX_IMAGE_WIDTH, WURFL_KEY_MAX_OBJECT_SIZE, WURFL_KEY_MAX_URL_LENGTH_CACHED_PAGE, WURFL_KEY_MAX_URL_LENGTH_IN_REQUEST, WURFL_KEY_PREFERRED_MARKUP, WURFL_KEY_RESOLUTION_HEIGHT, WURFL_KEY_RESOLUTION_WIDTH, WURFL_KEY_ROWS, XHTML_VER_BASIC, XHTML_VER_MP_1_0
 
Constructor Summary
RulesHandler(java.util.HashMap setting)
          Default constructor.
 
Method Summary
 void error(org.xml.sax.SAXParseException ex)
           
 void fatalError(org.xml.sax.SAXParseException ex)
           
 ClientProfile getClientProfileFromRules(javax.servlet.http.HttpServletRequest request)
          Allows system to evaluate the rules defined in the rules file.
 boolean hasRules()
          Check if this object holds any rules.
 void warning(org.xml.sax.SAXParseException ex)
          Receive notification of a warning.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RulesHandler

public RulesHandler(java.util.HashMap setting)
Default constructor.

Parameters:
setting - The configuration set for the EnhancedDispatcher. This method expects to find the configuration for the key EnhancedDispatcherConstants.CONF_KEY_RULES_LOCATION in the setting HashMap.
Method Detail

getClientProfileFromRules

public ClientProfile getClientProfileFromRules(javax.servlet.http.HttpServletRequest request)
Allows system to evaluate the rules defined in the rules file. First attempt is to match the User-Agent http header from request with an existing one from cache, if no match found the system is evaluating the rules one by one until a rule is matched. Returns the skin type for matched rule.

Parameters:
request - Reference to the HttpServletRequest object with all the parameters associated with the request sent from the client.
Returns:
The markup language of the skin matched from the rules. If no rules found then returns null.

warning

public void warning(org.xml.sax.SAXParseException ex)
             throws org.xml.sax.SAXException
Receive notification of a warning. SAX parsers will use this method to report conditions that are not errors or fatal errors as defined by the XML 1.0 recommendation. The default behaviour is to take no action. The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end.

Specified by:
warning in interface org.xml.sax.ErrorHandler
Parameters:
ex - The warning information encapsulated in a SAX parse exception.
Throws:
org.xml.sax.SAXException

error

public void error(org.xml.sax.SAXParseException ex)
           throws org.xml.sax.SAXException
Specified by:
error in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

fatalError

public void fatalError(org.xml.sax.SAXParseException ex)
                throws org.xml.sax.SAXException
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

hasRules

public boolean hasRules()
Check if this object holds any rules.

Returns:
True is at least one rule is found, false otherwise.

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.