Search in sources :

Example 11 with ScriptBuffer

use of org.directwebremoting.ScriptBuffer in project aries by apache.

the class ServerSideClass method addFunctionCall.

private void addFunctionCall(String name, Object... params) {
    final ScriptBuffer script = new ScriptBuffer();
    script.appendScript(name).appendScript("(");
    for (int i = 0; i < params.length; i++) {
        if (i != 0)
            script.appendScript(",");
        script.appendData(params[i]);
    }
    script.appendScript(");");
    Browser.withAllSessions(new Runnable() {

        public void run() {
            for (ScriptSession s : Browser.getTargetSessions()) {
                s.addScript(script);
            }
        }
    });
}
Also used : ScriptSession(org.directwebremoting.ScriptSession) ScriptBuffer(org.directwebremoting.ScriptBuffer)

Example 12 with ScriptBuffer

use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.

the class ScriptProxy method addFunctionCall.

/**
 * Call a named function with one parameter.
 * @param funcName The name of the function to call
 * @param param1 The first parameter to the above function
 * @param param2 The second parameter to the above function
 * @param param3 The third parameter to the above function
 */
public void addFunctionCall(String funcName, Object param1, Object param2, Object param3) {
    ScriptBuffer script = new ScriptBuffer();
    script.appendScript(funcName).appendScript("(").appendData(param1).appendScript(",").appendData(param2).appendScript(",").appendData(param3).appendScript(");");
    addScript(script);
}
Also used : ScriptBuffer(org.directwebremoting.ScriptBuffer)

Example 13 with ScriptBuffer

use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.

the class Engine method setHttpMethod.

/**
 * Which HTTP method do we use to send results? Must be one of "GET" or "POST".
 * @param httpMethod One of {@link #XMLHttpRequest}, {@link #IFrame} or {@link #ScriptTag}
 * @see <a href="http://getahead.org/dwr/browser/engine/options">Options documentation</a>
 */
public void setHttpMethod(String httpMethod) {
    ScriptBuffer script = new ScriptBuffer();
    script.appendScript("dwr.engine.setHttpMethod(").appendData(httpMethod).appendScript(");");
    addScript(script);
}
Also used : ScriptBuffer(org.directwebremoting.ScriptBuffer)

Example 14 with ScriptBuffer

use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.

the class Engine method setTimeout.

/**
 * Set a default timeout value for all calls. 0 (the default) turns timeouts off.
 * @param timeout The time to wait in milliseconds
 * @see <a href="http://getahead.org/dwr/browser/engine/errors">Error handling documentation</a>
 */
public void setTimeout(int timeout) {
    ScriptBuffer script = new ScriptBuffer();
    script.appendScript("dwr.engine.setTimeout(").appendData(timeout).appendScript(");");
    addScript(script);
}
Also used : ScriptBuffer(org.directwebremoting.ScriptBuffer)

Example 15 with ScriptBuffer

use of org.directwebremoting.ScriptBuffer in project ma-core-public by infiniteautomation.

the class Engine method setOrdered.

/**
 * Ensure that remote calls happen in the order in which they were sent? (Default: false)
 * @param ordered True to set call ordering.
 * @see <a href="http://getahead.org/dwr/browser/engine/ordering">Ordering documentation</a>
 */
public void setOrdered(boolean ordered) {
    ScriptBuffer script = new ScriptBuffer();
    script.appendScript("dwr.engine.setOrdered(").appendData(ordered).appendScript(");");
    addScript(script);
}
Also used : ScriptBuffer(org.directwebremoting.ScriptBuffer)

Aggregations

ScriptBuffer (org.directwebremoting.ScriptBuffer)20 IOException (java.io.IOException)1 ServletContext (javax.servlet.ServletContext)1 JspException (javax.servlet.jsp.JspException)1 JspWriter (javax.servlet.jsp.JspWriter)1 Container (org.directwebremoting.Container)1 ScriptSession (org.directwebremoting.ScriptSession)1 WebContextBuilder (org.directwebremoting.WebContextFactory.WebContextBuilder)1 ConverterManager (org.directwebremoting.extend.ConverterManager)1 MarshallException (org.directwebremoting.extend.MarshallException)1