public void load(HttpServletRequest request){
  Cookie[] cookies=request.getCookies();
  if (cookies != null && cookies.length > 0) {
    for (    Cookie cookie : cookies) {
      String name=cookie.getName();
      String value=cookie.getValue();
      if (name.startsWith("configuration.")) {
        if (IS_QUICK_SALES.equalsIgnoreCase(name)) {
          try {
            isQuickSales=Boolean.parseBoolean(value);
          }
 catch (          Exception e) {
            log.log(Level.WARNING,"Invalid value for: " + IS_QUICK_SALES + " Using default: "+ isQuickSales,e);
          }
        }
        if (IS_CUSTOMER_COMPULSORY.equalsIgnoreCase(name)) {
          try {
            isCustomerCompulsory=Boolean.parseBoolean(value);
          }
 catch (          Exception e) {
            log.log(Level.WARNING,"Invalid value for: " + IS_CUSTOMER_COMPULSORY + " Using default: "+ isCustomerCompulsory,e);
          }
        }
        if (ALLOW_CREDIT_SALES.equalsIgnoreCase(name)) {
          try {
            allowCreditSales=Boolean.parseBoolean(value);
          }
 catch (          Exception e) {
            log.log(Level.WARNING,"Invalid value for: " + ALLOW_CREDIT_SALES + " Using default: "+ allowCreditSales,e);
          }
        }
        if (ALLOW_CUSTOMER_RETURN_ORDER.equalsIgnoreCase(name)) {
          try {
            allowCustomerReturnOrder=Boolean.parseBoolean(value);
          }
 catch (          Exception e) {
            log.log(Level.WARNING,"Invalid value for: " + ALLOW_CUSTOMER_RETURN_ORDER + " Using default: "+ allowCustomerReturnOrder,e);
          }
        }
        if (ALLOW_INVOKE_CUSTOMER_RETURN_ORDER.equalsIgnoreCase(name)) {
          try {
            allowInvokeCustomerReturnOrder=Boolean.parseBoolean(value);
          }
 catch (          Exception e) {
            log.log(Level.WARNING,"Invalid value for: " + ALLOW_INVOKE_CUSTOMER_RETURN_ORDER + " Using default: "+ allowInvokeCustomerReturnOrder,e);
          }
        }
        if (PAYMENT_RULE.equalsIgnoreCase(name)) {
          if (value.equalsIgnoreCase(Constants.PAYMENT_RULE_CASH) || value.equalsIgnoreCase(Constants.PAYMENT_RULE_CARD) || value.equalsIgnoreCase(Constants.PAYMENT_RULE_CHEQUE)|| value.equalsIgnoreCase(Constants.PAYMENT_RULE_MIXED)) {
            paymentRule=value;
          }
 else {
            log.log(Level.WARNING,"Invalid value for: " + PAYMENT_RULE + " Using default: "+ paymentRule);
          }
        }
        if (SEARCH_PRODUCT_BY.equalsIgnoreCase(name)) {
          if (value.equalsIgnoreCase("barcode") || value.equalsIgnoreCase("name") || value.equalsIgnoreCase("description")) {
            searchProductBy=value;
          }
 else {
            log.log(Level.WARNING,"Invalid value for: " + SEARCH_PRODUCT_BY + " Using default: "+ searchProductBy);
          }
        }
      }
    }
  }
}

public void load ( HttpServletRequest request ) { Cookie [ ] cookies = request . getCookies ( ) ; if ( cookies != null && cookies . length > 0 ) { for ( Cookie cookie : cookies ) { String name = cookie . getName ( ) ; String value = cookie . getValue ( ) ; if ( name . startsWith ( "configuration." ) ) { if ( IS_QUICK_SALES . equalsIgnoreCase ( name ) ) { try { isQuickSales = Boolean . parseBoolean ( value ) ; } catch ( Exception e ) { log . log ( Level . WARNING , "Invalid value for: " + IS_QUICK_SALES + " Using default: " + isQuickSales , e ) ; } } if ( IS_CUSTOMER_COMPULSORY . equalsIgnoreCase ( name ) ) { try { isCustomerCompulsory = Boolean . parseBoolean ( value ) ; } catch ( Exception e ) { log . log ( Level . WARNING , "Invalid value for: " + IS_CUSTOMER_COMPULSORY + " Using default: " + isCustomerCompulsory , e ) ; } } if ( ALLOW_CREDIT_SALES . equalsIgnoreCase ( name ) ) { try { allowCreditSales = Boolean . parseBoolean ( value ) ; } catch ( Exception e ) { log . log ( Level . WARNING , "Invalid value for: " + ALLOW_CREDIT_SALES + " Using default: " + allowCreditSales , e ) ; } } if ( ALLOW_CUSTOMER_RETURN_ORDER . equalsIgnoreCase ( name ) ) { try { allowCustomerReturnOrder = Boolean . parseBoolean ( value ) ; } catch ( Exception e ) { log . log ( Level . WARNING , "Invalid value for: " + ALLOW_CUSTOMER_RETURN_ORDER + " Using default: " + allowCustomerReturnOrder , e ) ; } } if ( ALLOW_INVOKE_CUSTOMER_RETURN_ORDER . equalsIgnoreCase ( name ) ) { try { allowInvokeCustomerReturnOrder = Boolean . parseBoolean ( value ) ; } catch ( Exception e ) { log . log ( Level . WARNING , "Invalid value for: " + ALLOW_INVOKE_CUSTOMER_RETURN_ORDER + " Using default: " + allowInvokeCustomerReturnOrder , e ) ; } } if ( PAYMENT_RULE . equalsIgnoreCase ( name ) ) { if ( value . equalsIgnoreCase ( Constants . PAYMENT_RULE_CASH ) || value . equalsIgnoreCase ( Constants . PAYMENT_RULE_CARD ) || value . equalsIgnoreCase ( Constants . PAYMENT_RULE_CHEQUE ) || value . equalsIgnoreCase ( Constants . PAYMENT_RULE_MIXED ) ) { paymentRule = value ; } else { log . log ( Level . WARNING , "Invalid value for: " + PAYMENT_RULE + " Using default: " + paymentRule ) ; } } if ( SEARCH_PRODUCT_BY . equalsIgnoreCase ( name ) ) { if ( value . equalsIgnoreCase ( "barcode" ) || value . equalsIgnoreCase ( "name" ) || value . equalsIgnoreCase ( "description" ) ) { searchProductBy = value ; } else { log . log ( Level . WARNING , "Invalid value for: " + SEARCH_PRODUCT_BY + " Using default: " + searchProductBy ) ; } } } } } }
loads configuration from cookie
