Class WpdExtendlet

java.lang.Object
org.zkoss.zk.ui.http.WpdExtendlet
All Implemented Interfaces:
org.zkoss.web.util.resource.Extendlet

public class WpdExtendlet extends Object
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 Details

  • Constructor Details

    • WpdExtendlet

      public WpdExtendlet()
  • Method Details

    • init

      public void init(org.zkoss.web.util.resource.ExtendletConfig config)
    • service

      public void service(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path) throws jakarta.servlet.ServletException, IOException
      Throws:
      jakarta.servlet.ServletException
      IOException
    • retrieve

      protected byte[] retrieve(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String path) throws jakarta.servlet.ServletException, IOException
      Retrieves the content of the given path.
      Throws:
      jakarta.servlet.ServletException
      IOException
      Since:
      5.0.4
    • getDeviceType

      protected String 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(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String pkgTo, byte[] data) throws jakarta.servlet.ServletException, IOException
      Merges the JavaScript code of the mergeable packages defined in LanguageDefinition.getMergedJavaScriptPackages(java.lang.String).
      Throws:
      jakarta.servlet.ServletException
      IOException
      Since:
      5.0.4.
    • getScriptManager

      public ScriptManager getScriptManager()
    • splitSourceMapJsPathIfAny

      public List<String> splitSourceMapJsPathIfAny(String path) throws Exception
      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)
      Specified by:
      getFeature in interface org.zkoss.web.util.resource.Extendlet