protected String InferLangFromCookie(HttpServletRequest httpRequest)
    {
      // Try to locate a cookie that states the user's language preference.
      // Calling applications should use this name when setting the cookie.
      // Cookie name: "language-preference"
      // Permissible values: "fr" or "en"
      try
      {
        for (Cookie cookie : httpRequest.getCookies())
          if (cookie.getName().equals("language-preference"))
          {
            String lang = cookie.getValue();
            log.debug("Found language preference in cookie: " + lang);
            return lang;
          }
      }
      catch (Exception ex)
      {
        log.error("Unable to infer a lang parameter from cookie: " + ex.getMessage());
      }

      return null;
    }