Package org.restlet.ext.osgi
Class BaseDirectoryProvider
- java.lang.Object
-
- org.restlet.ext.osgi.BaseRestletProvider
-
- org.restlet.ext.osgi.BaseDirectoryProvider
-
- All Implemented Interfaces:
DirectoryProvider
,RestletProvider
public class BaseDirectoryProvider extends BaseRestletProvider implements DirectoryProvider
This class provides an implementation ofDirectoryProvider
. 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
-
-
Constructor Summary
Constructors Constructor Description BaseDirectoryProvider()
-
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 serviceprotected org.restlet.resource.Directory
createDirectory(org.restlet.Context context)
Creates the Restlet Directory instance using the rootUri, indexName, deeplyAccessible, modifiable, and negotiatingContent service propertiesprotected 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 org.restlet.ext.osgi.BaseRestletProvider
bindFilterProvider, unbindFilterProvider
-
-
-
-
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 classBaseRestletProvider
- Returns:
- the restlet to be filtered
-
getInboundRoot
public org.restlet.Restlet getInboundRoot(org.restlet.Context context)
- Specified by:
getInboundRoot
in interfaceRestletProvider
- Overrides:
getInboundRoot
in classBaseRestletProvider
- 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 interfaceDirectoryProvider
- Returns:
- the fully qualified path of the directory
-
-