Class Bridge

java.lang.Object
org.zkoss.zkplus.embed.Bridge

public class Bridge extends Object
Utilities to allow developers to start an execution in foreign Ajax channel.
Bridge bridge = Bridge.start(svlctx, request, response, desktop);
try {
    //execution is activated and you could access anything belonging to the desktop
    String jscode = bridge.getResult();
    //send jscode back to the client to update DOM, if any
} finally {
    bridge.close(); //stop the execution
}

See also Start Execution in Foreign Ajax Channel

Since:
5.0.5
Author:
tomyeh
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Bridge(jakarta.servlet.ServletContext svlctx, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.zkoss.zk.ui.Desktop desktop, Object locale)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the execution such that other requests targeting the same desktop can be processed.
    static org.zkoss.zk.ui.Desktop
    getDesktop(jakarta.servlet.ServletContext svlctx, jakarta.servlet.http.HttpServletRequest request, String dtid)
    Returns the desktop of the given desktop ID, or null if not found.
    org.zkoss.zk.ui.Execution
    Returns the execution.
    Returns the result in the JavaScript.
    static Bridge
    start(jakarta.servlet.ServletContext svlctx, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.zkoss.zk.ui.Desktop desktop)
    Starts an execution.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • start

      public static Bridge start(jakarta.servlet.ServletContext svlctx, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.zkoss.zk.ui.Desktop desktop)
      Starts an execution. After returned, the execution is activated and the caller is free to access any components belonging the given desktop.

      After processing, the caller shall invoke close() to stop the execution (in the finally clause).

      Parameters:
      desktop - the desktop you want to access. You could retrieve by use of getDesktop(jakarta.servlet.ServletContext, jakarta.servlet.http.HttpServletRequest, java.lang.String).
    • getDesktop

      public static org.zkoss.zk.ui.Desktop getDesktop(jakarta.servlet.ServletContext svlctx, jakarta.servlet.http.HttpServletRequest request, String dtid)
      Returns the desktop of the given desktop ID, or null if not found.
      Parameters:
      dtid - the desktop's ID.
    • getExecution

      public org.zkoss.zk.ui.Execution getExecution()
      Returns the execution.
    • getResult

      public String getResult()
      Returns the result in the JavaScript. The caller shall send it back and evaluate it at the client (eval(jscode);).

      After calling this method, the caller shall not modify the component's state any more.

    • close

      public void close()
      Closes the execution such that other requests targeting the same desktop can be processed. It must be called. Otherwise, the whole desktop might not be able to be accessed any more.