Class SlingScriptAdapterFactory

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

    public class SlingScriptAdapterFactory
    extends java.lang.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 java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void activate​(org.osgi.service.component.ComponentContext context)  
      protected void deactivate​(org.osgi.service.component.ComponentContext context)  
      <AdapterType>
      AdapterType
      getAdapter​(java.lang.Object adaptable, java.lang.Class<AdapterType> type)  
      java.lang.String getExtension​(java.lang.String mimeType)
      Returns the first extension entry of the supported extensions of a ScriptEngineFactory which is registered for the given MIME type.
      java.lang.String getMimeType​(java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BINDINGS_CONTEXT

        public static final java.lang.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​(java.lang.Object adaptable,
                                                    java.lang.Class<AdapterType> type)
        Specified by:
        getAdapter in interface org.apache.sling.api.adapter.AdapterFactory
      • getMimeType

        public java.lang.String getMimeType​(java.lang.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 java.lang.String getExtension​(java.lang.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)