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 of
ScriptingServiceInternal
- Since:
- 4.0
- Author:
- joseross
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]
protected org.springframework.context.ApplicationContext
protected org.craftercms.engine.util.spring.ApplicationContextAccessor
protected ContentService
protected boolean
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected MarketplaceService
protected Pattern
protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor
protected ScriptEngineManager
protected String
protected String
protected StudioConfiguration
-
Constructor Summary
ConstructorsConstructorDescriptionScriptingServiceInternalImpl
(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
Modifier and TypeMethodDescriptionvoid
protected groovy.lang.Binding
createBinding
(String siteId, String scriptUrl, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) executeRestScript
(String siteId, String scriptUrl, jakarta.servlet.http.HttpServletRequest request, jakarta.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
Reloads the classpath for the given sitevoid
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext)
-
Field Details
-
KEY_SITE_ID
- See Also:
-
KEY_PARAMS
- See Also:
-
KEY_PLUGIN_ID
- See Also:
-
KEY_PLUGIN_CONFIG
- See Also:
-
KEY_REQUEST
- See Also:
-
KEY_RESPONSE
- See Also:
-
KEY_LOGGER
- See Also:
-
KEY_APP_CONTEXT
- See Also:
-
pattern
-
scriptEngineManager
-
sandboxInterceptor
protected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor sandboxInterceptor -
scriptExtension
-
scriptPathFormat
-
enableVariableRestrictions
protected boolean enableVariableRestrictions -
allowedBeans
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
applicationContextAccessor
protected org.craftercms.engine.util.spring.ApplicationContextAccessor applicationContextAccessor -
marketplaceService
-
contentService
-
studioConfiguration
-
-
Constructor Details
-
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 Details
-
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, jakarta.servlet.http.HttpServletRequest request, jakarta.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, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws ConfigurationException - Throws:
ConfigurationException
-
reload
Description copied from interface:ScriptingServiceInternal
Reloads the classpath for the given site- Specified by:
reload
in interfaceScriptingServiceInternal
- Parameters:
siteId
- the id of the site
-
getPluginId
-
getPluginConfiguration
protected org.apache.commons.configuration2.Configuration getPluginConfiguration(String siteId, String pluginId) throws ConfigurationException - Throws:
ConfigurationException
-