コード例 #1
0
 @InitBinder
 public void setAllowedFields(WebDataBinder dataBinder) {
   dataBinder.setAllowedFields(
       "sourceGenericVulnerability.name",
       "targetGenericSeverity.id",
       "targetGenericSeverity.name",
       "targetGenericSeverity.displayName",
       "sourceChannelType.id",
       "sourceChannelType.name",
       "sourceChannelVulnerability.id",
       "sourceChannelVulnerability.name");
 }
コード例 #2
0
  /**
   * For some security. Defines which fields can be bound (whitelist), and which ones cannot.
   *
   * <p>Also adds validation that spans more than one field
   *
   * @param binder
   */
  @InitBinder
  public void initialiseBinder(WebDataBinder binder) {
    binder.setDisallowedFields("unitsOnOrder", "discontinued");
    binder.setAllowedFields(
        "productId",
        "name",
        "unitPrice",
        "description",
        "manufacturer",
        "category",
        "unitsInStock",
        "condition",
        "productImage",
        "productManual",
        "language");

    //		binder.addValidators(productValidator);
    binder.setValidator(productValidator);
  }
 @InitBinder("announcement")
 public void initBinder(WebDataBinder binder) {
   SimpleDateFormat dateFormat = new SimpleDateFormat(customDateFormat);
   dateFormat.setLenient(false);
   binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
   binder.registerCustomEditor(Topic.class, topicEditor);
   binder.setAllowedFields(
       new String[] {
         "id",
         "created",
         "author",
         "title",
         "abstractText",
         "message",
         "link",
         "startDisplay",
         "endDisplay",
         "parent",
         "action",
         "attachments"
       });
 }
 @InitBinder
 public void initBinderSecondParam(WebRequest wr, WebDataBinder dataBinder) {
   dataBinder.setAllowedFields("allowed1", "allowed2");
 }
 @InitBinder
 public void initBinderFirstParam(WebDataBinder dataBinder) {
   dataBinder.setAllowedFields("allowed1", "allowed2");
   dataBinder.setRequiredFields("required1", "required2");
   dataBinder.setDisallowedFields("disAllowed1", "disAllowed2");
 }
コード例 #6
0
 @InitBinder
 public void setAllowedFields(WebDataBinder dataBinder) {
   dataBinder.setAllowedFields(
       new String[] {"currentPassword", "unencryptedPassword", "passwordConfirm"});
 }
コード例 #7
0
 @InitBinder("user3")
 public void initBinder3(WebDataBinder binder) {
   binder.setFieldDefaultPrefix("user3.");
   binder.setAllowedFields("id");
 }
コード例 #8
-1
 @InitBinder("project")
 public void initProjectBinder(WebDataBinder binder) {
   binder.setAllowedFields();
 }