Class BaseResourceProvider

  • All Implemented Interfaces:
    ResourceProvider, RestletProvider

    public abstract class BaseResourceProvider
    extends BaseRestletProvider
    implements ResourceProvider
    This class provides an implementation of ResourceProvider. 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 Detail

      • BaseResourceProvider

        public BaseResourceProvider()
    • 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 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
      • getMatchingMode

        public int getMatchingMode()
        Specified by:
        getMatchingMode in interface ResourceProvider
        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 interface ResourceProvider
        Returns:
        the paths to the resource relative to the application alias. The paths must start with '/'.