|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.scripting.support.ResourceScriptSource
public class ResourceScriptSource
ScriptSource
implementation
based on Spring's 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).
InputStreamSource.getInputStream()
,
Resource.getFile()
,
ResourceLoader
Field Summary | |
---|---|
private java.lang.String |
encoding
|
private long |
lastModified
|
private java.lang.Object |
lastModifiedMonitor
|
protected Log |
logger
Logger available to subclasses |
private Resource |
resource
|
Constructor Summary | |
---|---|
ResourceScriptSource(Resource resource)
Create a new ResourceScriptSource for the given resource. |
Method Summary | |
---|---|
Resource |
getResource()
Return the Resource to load the
script from. |
java.lang.String |
getScriptAsString()
Retrieve the current script source text as String. |
boolean |
isModified()
Indicate whether the underlying script data has been modified since the last time ScriptSource.getScriptAsString() was called. |
protected long |
retrieveLastModifiedTime()
Retrieve the current last-modified timestamp of the underlying resource. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding used for reading the script resource. |
java.lang.String |
suggestedClassName()
Determine a class name for the underlying script. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Log logger
private final Resource resource
private long lastModified
private final java.lang.Object lastModifiedMonitor
private java.lang.String encoding
Constructor Detail |
---|
public ResourceScriptSource(Resource resource)
resource
- the Resource to load the script fromMethod Detail |
---|
public final Resource getResource()
Resource
to load the
script from.
public java.lang.String getScriptAsString() throws java.io.IOException
ScriptSource
getScriptAsString
in interface ScriptSource
java.io.IOException
- if script retrieval failedpublic boolean isModified()
ScriptSource
ScriptSource.getScriptAsString()
was called.
Returns true
if the script has not been read yet.
isModified
in interface ScriptSource
protected long retrieveLastModifiedTime()
public java.lang.String suggestedClassName()
ScriptSource
suggestedClassName
in interface ScriptSource
null
if none availablepublic void setEncoding(java.lang.String encoding)
encoding
- charset encoding used for reading the script.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |