|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.servlet.util.JavaScriptIncludeHandler
public class JavaScriptIncludeHandler
JavaScriptIncludeHandler handles writing JavaScript include statements and preventing multiple includes of the same file on a page.
The path to the JavaScript files may be set at a request/page scope
with static method
JavaScriptIncludeHandler.setPath
.
This value will override the value set by
ComponentPropertyManager.setJavaScriptLocation(String)
which may also may be used to set this path.
The map of tbean keys to filenames may be set on a local level
as well with the static method
JavaScriptIncludeHandler.addLocalMapping
.
The list of tbeans which have already been included is maintained
as an attribute in the request
object, as are the path
and the local mappings.
A JSP writer could set the JavaScript path and add a mapping with the following code:
JavaScriptIncludeHandler.setPath( "myjspath/", request ); JavaScriptIncludeHandler.addLocalMapping( TreeView.class, "local_TreeView.js", request );
ComponentPropertyManager.setJavaScriptLocation(String)
Field Summary | |
---|---|
static java.lang.String |
DOJO_JS
|
static java.lang.String |
SAS_COMMON_JS
|
static java.lang.String |
SAS_FASTCLICKPROTECTION_CUSTOMFUNCTIONS_JS
|
static java.lang.String |
SAS_FASTCLICKPROTECTION_JS
|
static java.lang.String |
SAS_MODALSELECTOR_JS
|
static java.lang.String |
SAS_RESIZING_JS
|
static java.lang.String |
SAS_TRANSFORMATIONBEAN_JS
|
Constructor Summary | |
---|---|
JavaScriptIncludeHandler(java.io.Writer out,
javax.servlet.http.HttpServletRequest request)
Constructor for JavaScriptIncludeHandler. |
Method Summary | |
---|---|
static void |
addLocalMapping(java.lang.Object key,
java.lang.String filename,
javax.servlet.http.HttpServletRequest request)
Add to the local mapping of tbean names to filenames and dependencies. |
static void |
addLocalMapping(java.lang.Object key,
java.lang.String filename,
java.lang.Object[] dependencies,
javax.servlet.http.HttpServletRequest request)
Add to the local mapping of tbean names to filenames. |
static java.lang.Object[] |
getDependencies(java.lang.Object key)
Get the dependencies associated with a tbean key. |
static java.lang.String |
getEndScript(java.lang.String noScript)
|
static java.lang.String |
getFilename(java.lang.Object key)
Get the filename associated with a tbean key. |
static boolean |
getIncluded(java.lang.Object tbean,
javax.servlet.http.HttpServletRequest request)
Indicate if the JavaScriptIncludeHandler has already included a tbean on a request/page. |
static java.lang.Object[] |
getLocalDependencies(java.lang.Object key,
javax.servlet.http.HttpServletRequest request)
Get the dependencies associated with a tbean key in the local mapping, which is only valid for the provided request. |
static java.lang.String |
getLocalFilename(java.lang.Object key,
javax.servlet.http.HttpServletRequest request)
Get the filename associated with a tbean key in the local mapping, which is only valid for the provided request. |
static java.lang.String |
getPath(javax.servlet.http.HttpServletRequest request)
Get the path to the location of the JavaScript files. |
static java.lang.String |
getStartScript()
|
static void |
setEnabled(boolean enable,
javax.servlet.http.HttpServletRequest request)
Enable or disable the writing of include statements on a request/page. |
static void |
setIncluded(java.lang.Object tbean,
boolean included,
javax.servlet.http.HttpServletRequest request)
Tell the JavaScriptIncludeHandler if a tbean has already been included on a request/page. |
static void |
setPath(java.lang.String path,
javax.servlet.http.HttpServletRequest request)
Set the path to the location of the JavaScript files. |
void |
writeIncludes(java.lang.Object tbean)
Write the JavaScript include statement if it hasn't already been included. |
static void |
writeIncludes(java.io.Writer out,
java.lang.Object tbean,
javax.servlet.http.HttpServletRequest request)
Write the JavaScript include statement if it hasn't already been included. |
static void |
writeIncludeStatement(java.io.Writer out,
java.lang.String filename,
java.lang.String path)
|
Field Detail |
---|
public static final java.lang.String DOJO_JS
public static final java.lang.String SAS_COMMON_JS
public static final java.lang.String SAS_MODALSELECTOR_JS
public static final java.lang.String SAS_RESIZING_JS
public static final java.lang.String SAS_TRANSFORMATIONBEAN_JS
public static final java.lang.String SAS_FASTCLICKPROTECTION_JS
public static final java.lang.String SAS_FASTCLICKPROTECTION_CUSTOMFUNCTIONS_JS
Constructor Detail |
---|
public JavaScriptIncludeHandler(java.io.Writer out, javax.servlet.http.HttpServletRequest request)
Method Detail |
---|
public void writeIncludes(java.lang.Object tbean) throws java.io.IOException
java.io.IOException
public static void writeIncludeStatement(java.io.Writer out, java.lang.String filename, java.lang.String path) throws java.io.IOException
java.io.IOException
public static java.lang.String getStartScript()
public static java.lang.String getEndScript(java.lang.String noScript)
public static void writeIncludes(java.io.Writer out, java.lang.Object tbean, javax.servlet.http.HttpServletRequest request) throws java.io.IOException
java.io.IOException
public static java.lang.String getFilename(java.lang.Object key)
public static java.lang.Object[] getDependencies(java.lang.Object key)
public static void addLocalMapping(java.lang.Object key, java.lang.String filename, java.lang.Object[] dependencies, javax.servlet.http.HttpServletRequest request)
setPath
will not be used.
public static void addLocalMapping(java.lang.Object key, java.lang.String filename, javax.servlet.http.HttpServletRequest request)
setPath
will not be
used.
public static java.lang.String getLocalFilename(java.lang.Object key, javax.servlet.http.HttpServletRequest request)
public static java.lang.Object[] getLocalDependencies(java.lang.Object key, javax.servlet.http.HttpServletRequest request)
public static void setPath(java.lang.String path, javax.servlet.http.HttpServletRequest request)
public static java.lang.String getPath(javax.servlet.http.HttpServletRequest request)
public static void setEnabled(boolean enable, javax.servlet.http.HttpServletRequest request)
public static void setIncluded(java.lang.Object tbean, boolean included, javax.servlet.http.HttpServletRequest request)
public static boolean getIncluded(java.lang.Object tbean, javax.servlet.http.HttpServletRequest request)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |