Often you want your visitors to be able to create content. For example, you want them to comment on articles, or fill in a "contact" form. Click here to see an example.
Enabling users to dynamically generate content is fine, but you probably wish to manage it in your CMS. The examples will show you how.
The nl.hippo.client.component package contains the following classes/interfaces for working with user generated content:
The abstract class UploadContext defines and implements a number of methods. These methods are mainly used to get information about where to store documents and to create new paths in the repository. UploadContext has one abstact method, createFolderStructure(String documentName), which returns a path in the repository based on the document name it receives. This method is abstract, because folder structures are never the same. For example, one project may require you to store all documents in a certain folder with a name representing the current date while another project needs you to store documents in alphabetic order.
The WebdavUploadable interface specifies the requirements for a document that has to be uploaded to the repository. Only classes that implement this interface can use the upload library to be uploaded to the repository. There are two basic requirements: the document must be able to provide a java.io.InputStream, and the document must be able to return it's own document type. The first requirement, the InputStream, is needed by the Java Adapter to retrieve the contents of the document and put them in the repository. For large text files this might be a java.io.FileInputStream to a file on a hard drive, but any InputStream will do. The second requirement, the document type, is a String representing the document type in the CMS. This type, which you've defined in your "types.xml" file, is needed to brand this document with a certain type that the CMS can recognize. Without the type the CMS can "see" the document, but doesn't know what it can actually "do" with it, or how the document is structured. By specifying a type the CMS will immediately recognize the document, enabling it to perform all known legal operations (editing, saving etc.).
The WebdavUploader is a class which only task is to upload documents to the repository. It uses the UploadContext class to check where to upload a document to and a WebdavUploadable object to upload. It shouldn't be necessary to override the upload method defined in this class.