public static int getIntAttribute(HttpServletRequest request, String name, int defaultNum) {
        String temp = (String)request.getAttribute(name);
        if (temp != null && !temp.isEmpty()) {
            int num = defaultNum;
            try {
                num = Integer.parseInt(temp);
            }
            catch (Exception ex) {
                Log.trace("An exception occurred while trying to parse attribute '{}' value '{}' as an integer. Will return default value '{}'", name, temp, defaultNum, ex);
            }
            return num;
        }
        else {
            return defaultNum;
        }
    }
Returns an attribute as a int.

@param request the HttpServletRequest object, known as "request" in a JSP page.
@param name the name of the attribute you want to get.
@param defaultNum the default value if the attribute is not present/cannot be parsed
@return the int value of the attribute or the default value if the
     attribute is not found or is a zero length string.
xmppserver/src/main/java/org/jivesoftware/util/ParamUtils.java