public static void setMenuPropertyValue(HttpServletRequest request, Integer v) { try { Principal userPrincipal = request.getUserPrincipal(); if (userPrincipal != null) { PreferenceAccessorFactory f = DefaultPreferenceAccessorFactory.getInstance(); PreferenceAccessor a = f.getUserPreferenceAccessor(); if (v == null) { a.setPreferenceProperty(userPrincipal, MENU_PROPERTY_NAME, null); } else { String value = v.toString(); a.setPreferenceProperty(userPrincipal, MENU_PROPERTY_NAME, value); } } } catch (Throwable ex) { ex.printStackTrace(); // TODO: Log! } }
protected static void setString( HttpServletRequest request, String propertyName, String propertyValue) { try { Principal userPrincipal = request.getUserPrincipal(); if (userPrincipal != null) { PreferenceAccessorFactory f = DefaultPreferenceAccessorFactory.getInstance(); PreferenceAccessor a = f.getUserPreferenceAccessor(); a.setPreferenceProperty(userPrincipal, propertyName, propertyValue); } } catch (Throwable ex) { ex.printStackTrace(); // TODO: Log! } }