org.springframework.scripting.ScriptSource implementation
based on Spring's org.springframework.core.io.Resource
abstraction. Loads the script text from the underlying Resource's
File or
InputStream,
and tracks the last-modified timestamp of the file (if possible).
org.springframework.core.io.Resource#getInputStream() , org.springframework.core.io.Resource#getFile() , org.springframework.core.io.ResourceLoader
| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private final Object | |
| protected final Log | logger
Logger available to subclasses. |
| private EncodedResource |
| Access | Constructor and Description |
|---|---|
| public | ResourceScriptSource(EncodedResource
the EncodedResource to load the script from resource)Create a new ResourceScriptSource for the given resource. |
| public | ResourceScriptSource(Resource
the Resource to load the script from (using UTF-8 encoding) resource)Create a new ResourceScriptSource for the given resource. |
| Modifier and Type | Method and Description |
|---|---|
| public final Resource | |
| public String | getScriptAsString()
Implements org. Retrieve the current script source text as String. |
| public boolean | isModified()
Implements org. Indicate whether the underlying script data has been modified since
the last time |
| protected long | Returns: the current timestamp, or 0 if not determinableRetrieve the current last-modified timestamp of the underlying resource. |
| public void | |
| public String | suggestedClassName()
Implements org. Determine a class name for the underlying script. |
| public String |
| lastModified | back to summary |
|---|---|
| private long lastModified | |
| lastModifiedMonitor | back to summary |
|---|---|
| private final Object lastModifiedMonitor | |
| logger | back to summary |
|---|---|
| protected final Log logger Logger available to subclasses. | |
| resource | back to summary |
|---|---|
| private EncodedResource resource | |
| ResourceScriptSource | back to summary |
|---|---|
| public ResourceScriptSource(EncodedResource resource) Create a new ResourceScriptSource for the given resource.
| |
| ResourceScriptSource | back to summary |
|---|---|
| public ResourceScriptSource(Resource resource) Create a new ResourceScriptSource for the given resource.
| |
| getResource | back to summary |
|---|---|
| public final Resource getResource() Return the | |
| getScriptAsString | back to summary |
|---|---|
| public String getScriptAsString() throws IOException Implements org. Doc from org. Retrieve the current script source text as String.
| |
| isModified | back to summary |
|---|---|
| public boolean isModified() Implements org. Doc from org. Indicate whether the underlying script data has been modified since
the last time
| |
| retrieveLastModifiedTime | back to summary |
|---|---|
| protected long retrieveLastModifiedTime() Retrieve the current last-modified timestamp of the underlying resource.
| |
| setEncoding | back to summary |
|---|---|
| public void setEncoding(String encoding) Set the encoding used for reading the script resource. The default value for regular Resources is "UTF-8".
A | |
| suggestedClassName | back to summary |
|---|---|
| public String suggestedClassName() Implements org. Doc from org. Determine a class name for the underlying script. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |