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.ApplicationContextprotected org.craftercms.engine.util.spring.ApplicationContextAccessorprotected ContentServiceprotected booleanstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected MarketplaceServiceprotected Patternprotected org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptorprotected ScriptEngineManagerprotected Stringprotected Stringprotected 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 TypeMethodDescriptionvoidprotected groovy.lang.BindingcreateBinding(String siteId, String scriptUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) 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.ConfigurationgetPluginConfiguration(String siteId, String pluginId) protected StringgetPluginId(String siteId, String scriptUrl) voidReloads the classpath for the given sitevoidsetApplicationContext(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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin 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:ScriptingServiceInternalExecutes a REST script from the site repository- Specified by:
executeRestScriptin 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
Description copied from interface:ScriptingServiceInternalReloads the classpath for the given site- Specified by:
reloadin 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
-