Class BaseDirectoryProvider

  • All Implemented Interfaces:
    DirectoryProvider, RestletProvider

    public class BaseDirectoryProvider
    extends BaseRestletProvider
    implements DirectoryProvider
    This class provides an implementation of DirectoryProvider. You register this class as an OSGi declarative service. The service declaration should look like:

     
     <?xml version="1.0" encoding="UTF-8"?>
     <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.example.app.directory">
       <implementation class="org.restlet.ext.osgi.BaseDirectoryProvider"/>
       <property name="path" type="String" value="/myDir"/>
       <property name="rootUri" type="String" value="file:/Path/to/dir"/>
       <service>
         <provide interface="org.restlet.ext.osgi.DirectoryProvider"/>
       </service>
     </scr:component>
     
     

    The service properties are:

    • path - the path to the resource relative to the application - required - must not be null
    • rootUri - the URI to the directory - required - must not be null
    • indexName - the index name - optional - defaults to "index"
    • deeplyAccessible - Indicates if the sub-directories are deeply accessible - optional - defaults to true
    • modifiable - Indicates if modifications to local resources are allowed - optional - defaults to false
    • negotiatingContent - Indicates if the best content is automatically negotiated - optional - defaults to true

    The referenced services are:

    • FilterProvider - optional - policy="static" cardinality="1..1"

    The provided services are:

    • DirectoryProvider

    Author:
    Bryan Hunt
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void activate​(org.osgi.service.component.ComponentContext context)
      Called by OSGi DS to activate the service
      protected org.restlet.resource.Directory createDirectory​(org.restlet.Context context)
      Creates the Restlet Directory instance using the rootUri, indexName, deeplyAccessible, modifiable, and negotiatingContent service properties
      protected org.restlet.Restlet getFilteredRestlet()
      Called by getInboundRoot() to determine the filtered restlet that is next in the chain.
      org.restlet.Restlet getInboundRoot​(org.restlet.Context context)  
      java.lang.String getPath()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseDirectoryProvider

        public BaseDirectoryProvider()
    • Method Detail

      • activate

        public void activate​(org.osgi.service.component.ComponentContext context)
        Called by OSGi DS to activate the service
        Parameters:
        context - the OSGi service context
      • createDirectory

        protected org.restlet.resource.Directory createDirectory​(org.restlet.Context context)
        Creates the Restlet Directory instance using the rootUri, indexName, deeplyAccessible, modifiable, and negotiatingContent service properties
        Parameters:
        context - the Restlet application context
        Returns:
        the configured Restlet Directory
      • getFilteredRestlet

        protected org.restlet.Restlet getFilteredRestlet()
        Description copied from class: BaseRestletProvider
        Called by getInboundRoot() to determine the filtered restlet that is next in the chain.
        Specified by:
        getFilteredRestlet in class BaseRestletProvider
        Returns:
        the restlet to be filtered
      • getInboundRoot

        public org.restlet.Restlet getInboundRoot​(org.restlet.Context context)
        Specified by:
        getInboundRoot in interface RestletProvider
        Overrides:
        getInboundRoot in class BaseRestletProvider
        Parameters:
        context - the Restlet application context
        Returns:
        the node to be used as the inbound root of the handling chain
      • getPath

        public java.lang.String getPath()
        Specified by:
        getPath in interface DirectoryProvider
        Returns:
        the fully qualified path of the directory