예제 #1
0
  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!
    }
  }
예제 #2
0
  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!
    }
  }