Package org.zkoss.zk.ui.http
Class WpdExtendlet
java.lang.Object
org.zkoss.zk.ui.http.WpdExtendlet
- All Implemented Interfaces:
Extendlet
The extendlet to handle WPD (Widget Package Descriptor).
Note: it assumes all JavaScript files are encoded in UTF-8.
Bootstrapping
In additions to loading, WPD allows to bootstrap a JavaScript codes by specifying a parameter called main. For example, the following link
<script type="text/javascript" src="/zkdemo/zkau/web/js/zk.wpd?main=foo.Go&what=12&more=xy" charset="UTF-8">
</script>
will cause the following to be executed
zk.load('foo', function() {foo.Go.main({what: '123', more: 'xy'})});
In other words, it loads the package called foo, and then
invoke the main method of the foo.Go class.- Since:
- 5.0.0
- Author:
- tomyeh
-
Field Summary
FieldsFields inherited from interface org.zkoss.web.util.resource.Extendlet
ALLOW_DIRECT_INCLUDE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringReturns the device type for this WpdExtendlet.booleangetFeature(int feature) Returns if the specified feature is supported.voidinit(ExtendletConfig config) Initializes the resource processor.booleanReturns whether to generate JS files that is easy to debug.protected byte[]mergeJavaScript(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String pkgTo, byte[] data) Merges the JavaScript code of the mergeable packages defined inLanguageDefinition.getMergedJavaScriptPackages(java.lang.String).protected byte[]retrieve(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String path) Retrieves the content of the given path.voidservice(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String path) Process the specified request.voidsetDebugJS(boolean debugJS) Sets whether to generate JS files that is easy to debug.Internal use only (since 10.0.0)
-
Field Details
-
SOURCE_MAP_JAVASCRIPT_PATH
- See Also:
-
-
Constructor Details
-
WpdExtendlet
public WpdExtendlet()
-
-
Method Details
-
init
Description copied from interface:ExtendletInitializes the resource processor. -
service
public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String path) throws javax.servlet.ServletException, IOException Description copied from interface:ExtendletProcess the specified request.path- the path mapped to this resource processor.- Throws:
javax.servlet.ServletExceptionIOException
-
retrieve
protected byte[] retrieve(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String path) throws javax.servlet.ServletException, IOException Retrieves the content of the given path.- Throws:
javax.servlet.ServletExceptionIOException- Since:
- 5.0.4
-
getDeviceType
Returns the device type for this WpdExtendlet.Default: ajax. The derived class might override it to implement a Wpd extendlet for other devices.
- Since:
- 5.0.4
-
mergeJavaScript
protected byte[] mergeJavaScript(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String pkgTo, byte[] data) throws javax.servlet.ServletException, IOException Merges the JavaScript code of the mergeable packages defined inLanguageDefinition.getMergedJavaScriptPackages(java.lang.String).- Throws:
javax.servlet.ServletExceptionIOException- Since:
- 5.0.4.
-
getScriptManager
-
splitSourceMapJsPathIfAny
Internal use only (since 10.0.0)- Throws:
Exception
-
setDebugJS
public void setDebugJS(boolean debugJS) Sets whether to generate JS files that is easy to debug. -
isDebugJS
public boolean isDebugJS()Returns whether to generate JS files that is easy to debug. -
getFeature
public boolean getFeature(int feature) Description copied from interface:ExtendletReturns if the specified feature is supported.- Specified by:
getFeaturein interfaceExtendlet
-