Package org.restlet.ext.osgi
Class BaseResourceProvider
- java.lang.Object
-
- org.restlet.ext.osgi.BaseRestletProvider
-
- org.restlet.ext.osgi.BaseResourceProvider
-
- All Implemented Interfaces:
ResourceProvider
,RestletProvider
public abstract class BaseResourceProvider extends BaseRestletProvider implements ResourceProvider
This class provides an implementation ofResourceProvider
. You register this class as an OSGi declarative service. It is expected that clients will extend this class to create the Finder for the resource. This allows the OSGi class loading mechanism to properly locate the resource class. 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.resource"> <implementation class="org.restlet.ext.osgi.BaseResourceProvider"/> <service> <provide interface="org.restlet.ext.osgi.ResourceProvider"/> </service> </scr:component>
The service properties are:
- paths - the path(s) to the resource relative to the application - required - must not be null - may be a single value or a String[]
- matchingMode - the URI matching mode - optional - defaults to Template.MODE_EQUALS
The referenced services are:
- FilterProvider - optional - policy="static" cardinality="1..1"
The provided services are:
- FilterProvider
- Author:
- Bryan Hunt
-
-
Constructor Summary
Constructors Constructor Description BaseResourceProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
activate(org.osgi.service.component.ComponentContext context)
Called by OSGi DS to activate the serviceprotected abstract org.restlet.resource.Finder
createFinder(org.restlet.Context context)
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)
int
getMatchingMode()
java.lang.String[]
getPaths()
-
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
-
createFinder
protected abstract org.restlet.resource.Finder createFinder(org.restlet.Context context)
- Parameters:
the
- restlet application context- Returns:
- the finder for the resource
-
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
-
getMatchingMode
public int getMatchingMode()
- Specified by:
getMatchingMode
in interfaceResourceProvider
- Returns:
- the matching mode to be used for template routes. Defaults to Template.MODE_EQUALS.
-
getPaths
public java.lang.String[] getPaths()
- Specified by:
getPaths
in interfaceResourceProvider
- Returns:
- the paths to the resource relative to the application alias. The paths must start with '/'.
-
-