Package org.directwebremoting

Examples of org.directwebremoting.ScriptBuffer


    public void toJson(Object data, Writer out) throws IOException
    {
        // Get the output stream and setup the mime type
        try
        {
            ScriptBuffer buffer = new ScriptBuffer();
            buffer.appendData(data);

            String output = ScriptBufferUtil.createOutput(buffer, converterManager, true);
            out.write(output);
        }
        catch (ConversionException ex)
        {
            log.warn("--ConversionException: class=" + ex.getConversionType().getName(), ex);

            ScriptBuffer buffer = new ScriptBuffer();
            buffer.appendData(ex);

            try
            {
                String output = ScriptBufferUtil.createOutput(buffer, converterManager, true);
                out.write(output);
View Full Code Here


        if (avoidConnectionLimitWithWindowName)
        {
            if (windowName == null || "".equals(windowName))
            {
                windowName = "DWR-" this.getContainer().getBean(IdGenerator.class).generate();
                ScriptBuffer script = EnginePrivate.getRemoteHandleNewWindowNameScript(windowName);
                scriptSession.addScript(script);
            }
            scriptSession.setWindowName(windowName);
        }
    }
View Full Code Here

        // Get a DWR Util proxy for all the browsers on the current page:
        Collection sessions = wctx.getScriptSessionsByPage(currentPage);
        Util utilAll = new Util(sessions);

        ScriptBuffer referenceInvoke = getInvokeFragment(args, wctx);

        // add the reference call to the Util proxy which will cause DWR to
        // asynchronously send it to be run on each active browser client
        utilAll.addScript(referenceInvoke);
    }
View Full Code Here

     * Creates a fragment of JavaScript code to invoke the reference function
     * Eg: "<referenceName>.<operationName>(arg1, arg2,...);"
     */
    protected ScriptBuffer getInvokeFragment(Object[] args, WebContext wctx) {

        ScriptBuffer sb = new ScriptBuffer();
        sb.appendScript(referenceFunction);
        sb.appendScript("(");
        if (args != null) {
            for (int i = 0; i < args.length; i++) {
                sb.appendData(args[i]);
                if (i < (args.length - 1)) {
                    sb.appendScript(", ");
                }
            }
        }
        sb.appendScript(");");

        return sb;
    }
View Full Code Here

  // update other users.
  @Deprecated
  public String openURL(String url) {
    _logger.debug("openurl called with        "+ url ); //$NON-NLS-1$
    WebContext wctx = WebContextFactory.get();
        ScriptBuffer script = new ScriptBuffer();
        script.appendScript("window.open(") //$NON-NLS-1$
        .appendData(url)
        .appendScript(");");        //$NON-NLS-1$
        wctx.getScriptSession().addScript(script);
        return ""; //$NON-NLS-1$
  }
View Full Code Here

   * Invoke the specified call on the script sessions of the pages in the supplied collection
   * @param pages the collection of pages in scope
   * @param call the method to invoke on the pages
   */
  private static void call(Collection<?> pages, String call){
        ScriptBuffer script = new ScriptBuffer();
        script.appendScript(call);
        for (Iterator<?> it = pages.iterator(); it.hasNext();){
            ScriptSession otherSession = (ScriptSession) it.next();
            otherSession.addScript(script);
       
  }
View Full Code Here

        // Get a DWR Util proxy for all the browsers on the current page:
        Collection sessions = wctx.getScriptSessionsByPage(currentPage);
        Util utilAll = new Util(sessions);

        ScriptBuffer referenceInvoke = getInvokeFragment(args, wctx);

        // add the reference call to the Util proxy which will cause DWR to
        // asynchronously send it to be run on each active browser client
        utilAll.addScript(referenceInvoke);
    }
View Full Code Here

     * Creates a fragment of JavaScript code to invoke the reference function
     * Eg: "<referenceName>.<operationName>(arg1, arg2,...);"
     */
    protected ScriptBuffer getInvokeFragment(Object[] args, WebContext wctx) {

        ScriptBuffer sb = new ScriptBuffer();
        sb.appendScript(referenceFunction);
        sb.appendScript("(");
        if (args != null) {
            for (int i = 0; i < args.length; i++) {
                sb.appendData(args[i]);
                if (i < (args.length - 1)) {
                    sb.appendScript(", ");
                }
            }
        }
        sb.appendScript(");");

        return sb;
    }
View Full Code Here

   * Invoke the specified call on the script sessions of the pages in the supplied collection
   * @param pages the collection of pages in scope
   * @param call the method to invoke on the pages
   */
  private static void call(Collection<?> pages, String call){
        ScriptBuffer script = new ScriptBuffer();
        script.appendScript(call);
        for (Iterator<?> it = pages.iterator(); it.hasNext();){
            ScriptSession otherSession = (ScriptSession) it.next();
            otherSession.addScript(script);
       
  }
View Full Code Here

  // update other users.
  @Deprecated
  public String openURL(String url) {
    _logger.debug("openurl called with        "+ url ); //$NON-NLS-1$
    WebContext wctx = WebContextFactory.get();
        ScriptBuffer script = new ScriptBuffer();
        script.appendScript("window.open(") //$NON-NLS-1$
        .appendData(url)
        .appendScript(");");        //$NON-NLS-1$
        wctx.getScriptSession().addScript(script);
        return ""; //$NON-NLS-1$
  }
View Full Code Here

TOP

Related Classes of org.directwebremoting.ScriptBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.