Class SlingScriptAdapterFactory

  • All Implemented Interfaces:
    org.apache.sling.api.adapter.AdapterFactory, org.apache.sling.commons.mime.MimeTypeProvider

    public class SlingScriptAdapterFactory
    extends Object
    implements org.apache.sling.api.adapter.AdapterFactory, org.apache.sling.commons.mime.MimeTypeProvider
    AdapterFactory that adapts Resources to the DefaultSlingScript servlet, which executes the Resources as scripts.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String BINDINGS_CONTEXT
      The context string to use to select BindingsValuesProviders
      • Fields inherited from interface org.apache.sling.api.adapter.AdapterFactory

        ADAPTABLE_CLASSES, ADAPTER_CLASSES, SERVICE_NAME
    • Field Detail

      • BINDINGS_CONTEXT

        public static final String BINDINGS_CONTEXT
        The context string to use to select BindingsValuesProviders
        See Also:
        Constant Field Values
    • Constructor Detail

      • SlingScriptAdapterFactory

        public SlingScriptAdapterFactory()
    • Method Detail

      • getAdapter

        public <AdapterType> AdapterType getAdapter​(@NotNull
                                                    @NotNull Object adaptable,
                                                    @NotNull
                                                    @NotNull Class<AdapterType> type)
        Specified by:
        getAdapter in interface org.apache.sling.api.adapter.AdapterFactory
      • getMimeType

        public String getMimeType​(String name)
        Returns the first MIME type entry of the supported MIME types of a ScriptEngineFactory which is registered for the extension of the given name. If no ScriptEngineFactory is registered for the given extension or the registered ScriptEngineFactory is not registered for a MIME type, this method returns null.
        Specified by:
        getMimeType in interface org.apache.sling.commons.mime.MimeTypeProvider
        Parameters:
        name - The name whose extension is to be mapped to a MIME type. The extension is the string after the last dot in the name. If the name contains no dot, the entire name is considered the extension.
      • getExtension

        public String getExtension​(String mimeType)
        Returns the first extension entry of the supported extensions of a ScriptEngineFactory which is registered for the given MIME type. If no ScriptEngineFactory is registered for the given MIME type or the registered ScriptEngineFactory is not registered for an extensions, this method returns null.
        Specified by:
        getExtension in interface org.apache.sling.commons.mime.MimeTypeProvider
        Parameters:
        mimeType - The MIME type to be mapped to an extension.
      • activate

        protected void activate​(org.osgi.service.component.ComponentContext context)
      • deactivate

        protected void deactivate​(org.osgi.service.component.ComponentContext context)