Annotation Interface OnUIUpload


@Documented @Retention(RUNTIME) @Target(METHOD) @Repeatable(OnUIUploads.class) public @interface OnUIUpload
Annotation for tagging methods to receive the upload events of a file upload component (UIFileUpload): the client's request to upload files, which the method may deny, and what becomes of each file.

Only 1 acceptable method pattern for this annotation.
Note: methodName can be any name you want to use.

Example:

  @UI(ref="Proj:/panel/subFolder/OnePanel")
  public class MyUIListener
    {
    public MyUIListener()
      {
      ...
      }

    // Method called for every upload event of the component.
    @OnUIUpload(name="myUpload")
    public void onUpload(UIUploadEvent event)
      {
      switch(event.getType())
        {
        case REQUEST:
          if ( event.getRequest().getFiles().size()>3 )
            event.deny("tooManyFiles");
          break;

        case FILE_COMPLETED:
          File file=event.getUploadedFile().take();
          ...
          break;

        default:
          break;
        }
      }
    }

A completed file that is neither taken nor deleted in FILE_COMPLETED stays the server's and is removed with its reservation at the next sweep.

Author:
Christopher Mindus
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The Name or Relative Path of the Property to associate with the method.
  • Element Details

    • name

      String name
      The Name or Relative Path of the Property to associate with the method. The name is either a Name without slash ('/') that is a direct child of the panel reference, or a Relative Path from the Panel root.
      Returns:
      The Property Name path from the panel base "ref" reference specification, e.g. "myUpload" or "container/..etc../myUpload".