Class SlingScriptAdapterFactory
- java.lang.Object
-
- org.apache.sling.scripting.core.impl.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
-
Constructor Summary
Constructors Constructor Description SlingScriptAdapterFactory()
-
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>
AdapterTypegetAdapter(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.
-
-
-
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
-
-
Method Detail
-
getAdapter
public <AdapterType> AdapterType getAdapter(java.lang.Object adaptable, java.lang.Class<AdapterType> type)
- Specified by:
getAdapter
in interfaceorg.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 returnsnull
.- Specified by:
getMimeType
in interfaceorg.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 returnsnull
.- Specified by:
getExtension
in interfaceorg.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)
-
-