public static void setProperties(Object bean, HttpServletRequest request) {
        for (Enumeration<String> propNames = request.getParameterNames(); propNames.hasMoreElements();) {
            String propName = propNames.nextElement();
            try {
                // Create a property descriptor for the named property. If
                // the bean doesn't have the named property, an
                // Introspection will be thrown.
                PropertyDescriptor descriptor = new PropertyDescriptor(
                        propName, bean.getClass());
                // Load the class type of the property.
                Class<?> propertyType = descriptor.getPropertyType();
                // Get the value of the property by converting it from a
                // String to the correct object type.
                Object value = decode(propertyType, request.getParameter(propName));
                // Set the value of the bean.
                descriptor.getWriteMethod().invoke(bean, value);
            }
            catch (IntrospectionException ie) {
                // Ignore. This exception means that the key in the map
                // does not correspond to a property of the bean.
            }
            catch (InvocationTargetException ite) {
                // Ignore. This exception most often occurs when a
                // value in the map is null and the target method doesn't
                // support null properties.
            }
            catch (IllegalAccessException e) {
                Log.error(e.getMessage(), e);
            }
            catch (Exception e) {
                Log.error(e.getMessage(), e);
            }
        }
    }
Sets the properties of a Java Bean based on the request's properties. Because
this method has to know how to convert a String value into the correct type
for the bean, only a few bean property types are supported. They are: String,
boolean, int, long, float, double, Color, and Class.<p>

If key/value pairs exist in the Map that don't correspond to properties
of the bean, they will be ignored.

@param bean the JavaBean to set properties on.
@param request the HTTP request.
xmppserver/src/main/java/org/jivesoftware/util/BeanUtils.java