Class AbstractServiceReferenceConfig

  • @Deprecated
    public abstract class AbstractServiceReferenceConfig
    extends Object
    The AbstractServiceReferenceConfig may be used as a base class to define ServletConfig and FilterConfig instances from OSGi ServiceReference objects. The properties of this service reference are used as the initialization parameters of the configuration object.

    The name of the servlet or filter may be retrieved from the service reference by calling the static getName(ServiceReference) method. This method looks for the following service reference properties, assuming the first non-null value found:

    1. sling.core.servletName - A service registration property which may be set to define an independent servlet name.
    2. - The name of the Declarative Services component if the OSGi service is registered using Declarative Services.
    3. - The Service PID of the service.
    4. - The ID of the service as set by the OSGi framework service registry. This property is guaranteed to always be set by the OSGi specification.
    • Constructor Detail

      • AbstractServiceReferenceConfig

        public AbstractServiceReferenceConfig​(ServletContext servletContext,
                                              ServiceReference reference,
                                              String name)
        Sets up this base configuration object.
        servletContext - The ServletContext attached to this configuration.
        reference - The service reference providing the initialization parameter values.
        name - The name of this configuration.
        See Also:
    • Method Detail

      • getInitParameter

        public String getInitParameter​(String name)
      • getInitParameterNames

        public Enumeration<?> getInitParameterNames()
      • getServletContext

        public ServletContext getServletContext()
      • getName

        public static String getName​(ServiceReference reference)
        Looks for a name value in the service reference properties. See the class comment at the top for the list of properties checked by this method.
        reference - The service reference
        The name