Class ScriptingServiceInternalImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v2.service.scripting.internal.ScriptingServiceInternalImpl
-
- All Implemented Interfaces:
ScriptingServiceInternal
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
public class ScriptingServiceInternalImpl extends Object implements ScriptingServiceInternal, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Default implementation ofScriptingServiceInternal
- Since:
- 4.0
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]
allowedBeans
protected org.springframework.context.ApplicationContext
applicationContext
protected org.craftercms.engine.util.spring.ApplicationContextAccessor
applicationContextAccessor
protected ContentService
contentService
protected boolean
enableVariableRestrictions
static String
KEY_APP_CONTEXT
static String
KEY_LOGGER
static String
KEY_PARAMS
static String
KEY_PLUGIN_CONFIG
static String
KEY_PLUGIN_ID
static String
KEY_REQUEST
static String
KEY_RESPONSE
static String
KEY_SITE_ID
protected MarketplaceService
marketplaceService
protected Pattern
pattern
protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor
sandboxInterceptor
protected ScriptEngineManager
scriptEngineManager
protected String
scriptExtension
protected String
scriptPathFormat
protected StudioConfiguration
studioConfiguration
-
Constructor Summary
Constructors Constructor Description ScriptingServiceInternalImpl(ScriptEngineManager scriptEngineManager, org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor, String scriptExtension, String scriptPathFormat, boolean enableVariableRestrictions, String[] allowedBeans, MarketplaceService marketplaceService, ContentService contentService, StudioConfiguration studioConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
protected groovy.lang.Binding
createBinding(String siteId, String scriptUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Object
executeRestScript(String siteId, String scriptUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Executes a REST script from the site repositoryprotected org.apache.commons.configuration2.Configuration
getPluginConfiguration(String siteId, String pluginId)
protected String
getPluginId(String siteId, String scriptUrl)
void
reload(String siteId)
Reloads the classpath for the given sitevoid
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
-
-
Field Detail
-
KEY_SITE_ID
public static final String KEY_SITE_ID
- See Also:
- Constant Field Values
-
KEY_PARAMS
public static final String KEY_PARAMS
- See Also:
- Constant Field Values
-
KEY_PLUGIN_ID
public static final String KEY_PLUGIN_ID
- See Also:
- Constant Field Values
-
KEY_PLUGIN_CONFIG
public static final String KEY_PLUGIN_CONFIG
- See Also:
- Constant Field Values
-
KEY_REQUEST
public static final String KEY_REQUEST
- See Also:
- Constant Field Values
-
KEY_RESPONSE
public static final String KEY_RESPONSE
- See Also:
- Constant Field Values
-
KEY_LOGGER
public static final String KEY_LOGGER
- See Also:
- Constant Field Values
-
KEY_APP_CONTEXT
public static final String KEY_APP_CONTEXT
- See Also:
- Constant Field Values
-
pattern
protected Pattern pattern
-
scriptEngineManager
protected ScriptEngineManager scriptEngineManager
-
sandboxInterceptor
protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor
-
scriptExtension
protected String scriptExtension
-
scriptPathFormat
protected String scriptPathFormat
-
enableVariableRestrictions
protected boolean enableVariableRestrictions
-
allowedBeans
protected String[] allowedBeans
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext
-
applicationContextAccessor
protected org.craftercms.engine.util.spring.ApplicationContextAccessor applicationContextAccessor
-
marketplaceService
protected MarketplaceService marketplaceService
-
contentService
protected ContentService contentService
-
studioConfiguration
protected StudioConfiguration studioConfiguration
-
-
Constructor Detail
-
ScriptingServiceInternalImpl
@ConstructorProperties({"scriptEngineManager","sandboxInterceptor","scriptExtension","scriptPathFormat","enableVariableRestrictions","allowedBeans","marketplaceService","contentService","studioConfiguration"}) public ScriptingServiceInternalImpl(ScriptEngineManager scriptEngineManager, org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor, String scriptExtension, String scriptPathFormat, boolean enableVariableRestrictions, String[] allowedBeans, MarketplaceService marketplaceService, ContentService contentService, StudioConfiguration studioConfiguration)
-
-
Method Detail
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
executeRestScript
public Object executeRestScript(String siteId, String scriptUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws groovy.util.ResourceException, groovy.util.ScriptException, ConfigurationException
Description copied from interface:ScriptingServiceInternal
Executes a REST script from the site repository- Specified by:
executeRestScript
in interfaceScriptingServiceInternal
- Parameters:
siteId
- the id of the sitescriptUrl
- the path of the scriptrequest
- the current requestresponse
- the current response- Returns:
- the value returned by the script
- Throws:
groovy.util.ResourceException
- if there is any error loading the scriptgroovy.util.ScriptException
- if there is any error executing the scriptConfigurationException
-
createBinding
protected groovy.lang.Binding createBinding(String siteId, String scriptUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws ConfigurationException
- Throws:
ConfigurationException
-
reload
public void reload(String siteId)
Description copied from interface:ScriptingServiceInternal
Reloads the classpath for the given site- Specified by:
reload
in interfaceScriptingServiceInternal
- Parameters:
siteId
- the id of the site
-
getPluginConfiguration
protected org.apache.commons.configuration2.Configuration getPluginConfiguration(String siteId, String pluginId) throws ConfigurationException
- Throws:
ConfigurationException
-
-