Package org.wicketstuff.nashorn.resource
Class NashornResourceReference
- java.lang.Object
-
- org.apache.wicket.request.resource.ResourceReference
-
- org.wicketstuff.nashorn.resource.NashornResourceReference
-
- All Implemented Interfaces:
Serializable
,IClusterable
public class NashornResourceReference extends ResourceReference
Creates a nashorn resource reference to accept java script code from the client side.
Please ensure to use theNashornSecurityManager
to restrict class access.- Author:
- Tobias Soloschenko
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wicket.request.resource.ResourceReference
ResourceReference.Key, ResourceReference.LambdaResourceReference, ResourceReference.UrlAttributes
-
-
Constructor Summary
Constructors Constructor Description NashornResourceReference(String name, int coreSize, long delay, TimeUnit delayUnit)
Creates a nashorn resource reference with the given nameNashornResourceReference(String name, int coreSize, long delay, TimeUnit delayUnit, long wait, TimeUnit waitUnit, long maxScriptMemorySize)
Creates a nashorn resource reference with the given name
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ClassFilter
getClassFilter()
Gets the class filter to apply to the scripting engineprotected Writer
getErrorWriter()
Gets the writer to which error messages are going to be written to the default is to useNullWriter
IResource
getResource()
ScheduledExecutorService
getScheduledExecutorService()
Gets the scheduled executor servicesprotected Writer
getWriter()
Gets the writer to which print outputs are going to be written to the default is to useNullWriter
protected boolean
isDebug()
If debug is enabledprotected AbstractResource.ResourceResponse
processError(Exception e)
Customize the error response sent to the clientprotected void
setup(IResource.Attributes attributes, Bindings bindings)
Setup the bindings and make information available to the scripting context-
Methods inherited from class org.apache.wicket.request.resource.ResourceReference
canBeRegistered, equals, getDependencies, getExtension, getKey, getLocale, getName, getScope, getStyle, getUrlAttributes, getVariation, hashCode, of, of, toString
-
-
-
-
Constructor Detail
-
NashornResourceReference
public NashornResourceReference(String name, int coreSize, long delay, TimeUnit delayUnit)
Creates a nashorn resource reference with the given name- Parameters:
name
- the name of the nashorn resource referencecoreSize
- the core size of the script execution pooldelay
- the delay until a script execution is going to be terminateddelayUnit
- the unit until a script execution is going to be terminated
-
NashornResourceReference
public NashornResourceReference(String name, int coreSize, long delay, TimeUnit delayUnit, long wait, TimeUnit waitUnit, long maxScriptMemorySize)
Creates a nashorn resource reference with the given name- Parameters:
name
- the name of the nashorn resource referencecoreSize
- the core size of the script execution pooldelay
- the delay until a script execution is going to be terminateddelayUnit
- the unit until a script execution is going to be terminatedwait
- how long to w8 until the next memory check occurswaitUnit
- the unit until the next memory check occursmaxScriptMemorySize
- the memory usage the script process should use - else it will be aborted
-
-
Method Detail
-
getResource
public IResource getResource()
- Specified by:
getResource
in classResourceReference
-
processError
protected AbstractResource.ResourceResponse processError(Exception e)
Customize the error response sent to the client- Parameters:
e
- the exception occurred- Returns:
- the error response
-
setup
protected void setup(IResource.Attributes attributes, Bindings bindings)
Setup the bindings and make information available to the scripting context- Parameters:
attributes
- the attributes of the requestbindings
- the bindings to add java objects to
-
getClassFilter
protected ClassFilter getClassFilter()
Gets the class filter to apply to the scripting engine- Returns:
- the class filter to apply to the scripting engine
-
getWriter
protected Writer getWriter()
Gets the writer to which print outputs are going to be written to the default is to useNullWriter
- Returns:
- the writer for output
-
getErrorWriter
protected Writer getErrorWriter()
Gets the writer to which error messages are going to be written to the default is to useNullWriter
- Returns:
- the error writer
-
isDebug
protected boolean isDebug()
If debug is enabled- Returns:
- if debug is enabled
-
getScheduledExecutorService
public ScheduledExecutorService getScheduledExecutorService()
Gets the scheduled executor services- Returns:
- the scheduled executor service
-
-