This sample explains how to restrict the addition of files having a particular media type. We will be reusing the code of the Handler Sample in this example. This sample requires Apache Maven. See Installation Prerequisites for links on how to install it.
1. Navigate to
samples/handler/src to find the source code of the Handler Sample.
2. Add a new Java Class named
GREG_HOME/samples/handler/src/src/main/java/org/wso2/carbon/registry/samples/handler/RestrictionHandler.java with the following source:
3. Compile the source code by running the following command inside
mvn clean install will trigger an Apache Maven Build in your command line. This requires you having installed Apache Maven. See Installation Prerequisites for links on how to install it.
A successful run of Apache Maven will generate a report similar to the following:
3. Copy the <
4. Edit the
registry.xml file which is in
GREG_HOME/repository/conf folder and add an XML snippet similar to the following. In this example, add this handler as the very first handler in the registry.xml file.
The configuration above is used to restrict the addition of executable files into the WSO2 Governance Registry. There is no point to go ahead with any other processing for these types of media, which is why we added this handler as the very first handler in the registry.xml file.
See also Handler Sample.
5. Start the WSO2 Governance Registry. See Running the Product for more information.