当前位置: 首页>>代码示例>>Java>>正文


Java WebContext.getScriptSession方法代码示例

本文整理汇总了Java中org.directwebremoting.WebContext.getScriptSession方法的典型用法代码示例。如果您正苦于以下问题:Java WebContext.getScriptSession方法的具体用法?Java WebContext.getScriptSession怎么用?Java WebContext.getScriptSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.directwebremoting.WebContext的用法示例。


在下文中一共展示了WebContext.getScriptSession方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: subscribe

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * Ensure that the clients know about server publishes
 * @param topic The topic being subscribed to
 * @param subscriptionId The ID to pass back to link to client side data
 */
@SuppressWarnings("unchecked")
public void subscribe(String topic, String subscriptionId)
{
    WebContext webContext = WebContextFactory.get();
    Hub hub = HubFactory.get();
    final ScriptSession session = webContext.getScriptSession();

    // Create a subscription block
    BrowserMessageListener subscription = new BrowserMessageListener(session, topic, subscriptionId);

    Map<String, BrowserMessageListener> subscriptions = (Map<String, BrowserMessageListener>) session.getAttribute(ATTRIBUTE_SUBSCRIPTIONS);
    if (subscriptions == null)
    {
        subscriptions = new HashMap<String, BrowserMessageListener>();
    }
    subscriptions.put(subscriptionId, subscription);
    session.setAttribute(ATTRIBUTE_SUBSCRIPTIONS, subscriptions);

    hub.subscribe(subscription.topic, subscription);
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:26,代码来源:System.java

示例2: initializeJsp

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * @throws IOException
 * @throws ServletException
 */
@Override
public void initializeJsp(String searchResultJsp) throws ServletException, IOException {
    WebContext wctx = WebContextFactory.get();
    workspace = (DisplayableUserWorkspace) wctx.getSession().getAttribute("displayableWorkspace");
    if (workspace.getDataElementSearchObject().getKeywordsForSearch() != null) {
        utilThis = new Util(wctx.getScriptSession());
        utilThis.setValue("searchResult", wctx.forwardToString(searchResultJsp), false);
        utilThis.setValue("errorMessages", "");
        populateAnnotationDefinitionTable();
        populateCaDsrTable();
    }
    boolean killedThreads = inititalizeAndCheckTimeout();
    if (annotationDefinitionSearchThread != null
            && annotationDefinitionSearchThread.isAlive()
            && !killedThreads) {
            setAnnotationDefinitionInProgress();
    }
    if (caDsrSearchThread != null
            && caDsrSearchThread.isAlive()
            && !killedThreads) {
            setCaDsrInProgress();
    }
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:29,代码来源:DataElementSearchAjaxUpdater.java

示例3: runDicomJob

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void runDicomJob() {
    WebContext wctx = WebContextFactory.get();
    DisplayableUserWorkspace workspace = (DisplayableUserWorkspace) 
        wctx.getSession().getAttribute("displayableWorkspace");
    utilThis = new Util(wctx.getScriptSession());
    dicomJob = workspace.getDicomJob();
    
    if (dicomJob != null) {
        initializeJobDescription();
        DicomRetrievalAjaxRunner runner = new DicomRetrievalAjaxRunner(this);
        new Thread(runner).start();
    } else {
        addErrorMessage("No Dicom Job was found on the Session");
    }
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:19,代码来源:DicomRetrievalAjaxUpdater.java

示例4: addMessage

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * @param text The new message text to add
 */
public void addMessage(String text)
{
    // Make sure we have a list of the list 10 messages
    if (text != null && text.trim().length() > 0)
    {
        messages.addFirst(new Message(text));
        while (messages.size() > 10)
        {
            messages.removeLast();
        }
    }

    WebContext wctx = WebContextFactory.get();
    String currentPage = wctx.getCurrentPage();

    // Clear the input box in the browser that kicked off this page only
    Util utilThis = new Util(wctx.getScriptSession());
    utilThis.setValue("text", "");

    // For all the browsers on the current page:
    Collection sessions = wctx.getScriptSessionsByPage(currentPage);
    Util utilAll = new Util(sessions);

    // Clear the list and add in the new set of messages
    utilAll.removeAllOptions("chatlog");
    utilAll.addOptions("chatlog", messages, "text");
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:JavaChat.java

示例5: enroll

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * Called by clients that wish to be included in the whole hub sync thing.
 */
public void enroll()
{
    WebContext webContext = WebContextFactory.get();
    ScriptSession scriptSession = webContext.getScriptSession();
    synchronized (enrolledScriptSessions)
    {
        enrolledScriptSessions.add(scriptSession);
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:13,代码来源:OpenAjaxSynchronizer.java

示例6: executeCallback

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * The reverse of {@link CallbackHelper#saveCallback(Callback, Class)}
 * which executes a {@link Callback} which has been called by the browser
 */
@SuppressWarnings("unchecked")
public static <T> void executeCallback(String key, RealRawData data) throws ConversionException
{
    WebContext webContext = WebContextFactory.get();
    ScriptSession session = webContext.getScriptSession();
    ConverterManager converterManager = webContext.getContainer().getBean(ConverterManager.class);

    Map<String, Class<T>> typeMap = (Map<String, Class<T>>) session.getAttribute(KEY_TYPE);
    Class<T> type = typeMap.remove(key);
    session.removeAttribute(KEY_TYPE);
    session.setAttribute(KEY_TYPE, typeMap);

    try
    {
        Method method = Callback.class.getMethod("dataReturned", type);

        Property property = new ParameterProperty(new MethodDeclaration(method), 0);
        InboundVariable iv = data.getInboundVariable();
        Object callbackData  = converterManager.convertInbound(type, iv, property);

        Map<String, Callback<T>> callbackMap = (Map<String, Callback<T>>) session.getAttribute(KEY_TYPE);
        Callback<T> callback = callbackMap.remove(key);
        session.removeAttribute(KEY_TYPE);
        session.setAttribute(KEY_CALLBACK, callbackMap);

        callback.dataReturned((T) callbackData);
    }
    catch (Exception ex)
    {
        throw new ConversionException(type, ex);
    }
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:37,代码来源:DefaultCallbackHelper.java

示例7: pageUnloaded

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * Call {@link ScriptSession#invalidate()} on the {@link ScriptSession}
 * that called this method.
 * Used by the page unloader.
 */
public void pageUnloaded()
{
    WebContext wctx = WebContextFactory.get();
    ScriptSession scriptSession = wctx.getScriptSession();

    log.debug("pageUnloaded is invalidating scriptSession: " + scriptSession);
    scriptSession.invalidate();
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:14,代码来源:System.java

示例8: unsubscribe

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * Stop notifications of against a subscription id
 * @param subscriptionId The ID to pass back to link to client side data
 * @return true iff someone was unsubscribed
 */
@SuppressWarnings("unchecked")
public boolean unsubscribe(String subscriptionId)
{
    WebContext webContext = WebContextFactory.get();
    Hub hub = HubFactory.get();
    ScriptSession session = webContext.getScriptSession();

    Map<String, BrowserMessageListener> subscriptions = (Map<String, BrowserMessageListener>) session.getAttribute(ATTRIBUTE_SUBSCRIPTIONS);
    BrowserMessageListener subscription = subscriptions.get(subscriptionId);

    return hub.unsubscribe(subscription.topic, subscription);
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:18,代码来源:System.java

示例9: pingMe

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * 
 */
public void pingMe()
{
    WebContext wctx = WebContextFactory.get();
    final ScriptSession scriptSession = wctx.getScriptSession();
    Thread worker = new Thread(new Runnable()
    {
        public void run()
        {
            int count = 0;
            while (count < 100)
            {
                count++;
                try
                {
                    Thread.sleep(1000);
                    log.debug("ping: " + count);
                    scriptSession.addScript(new ScriptBuffer("dwr.util.setValue('ping', 'count=" + count + "');"));
                }
                catch (Exception ex)
                {
                    log.warn("Waking:", ex);
                }
            }
        }
    });
    worker.start();
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:31,代码来源:JavascriptChat.java

示例10: runViewer

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void runViewer() {
    WebContext wctx = WebContextFactory.get();
    DisplayableUserWorkspace workspace = (DisplayableUserWorkspace) 
        wctx.getSession().getAttribute("displayableWorkspace");
    utilThis = new Util(wctx.getScriptSession());
    run(workspace);
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:11,代码来源:AbstractViewerAjaxUpdater.java

示例11: inititalizeAndCheckTimeout

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
private boolean inititalizeAndCheckTimeout() {
    WebContext wctx = WebContextFactory.get();
    workspace = (DisplayableUserWorkspace) wctx.getSession().getAttribute("displayableWorkspace");
    utilThis = new Util(wctx.getScriptSession());
    utilThis.setValue("errorMessages", "");
    if (checkTimeout()) {
        killRunningThreads();
        return true;
    }
    return false;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:12,代码来源:DataElementSearchAjaxUpdater.java

示例12: get

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public ScriptSession get()
{
    WebContext webcx = WebContextFactory.get();
    return webcx.getScriptSession();
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:6,代码来源:DwrGuiceServletModule.java

示例13: logOut

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
private void logOut() {
	WebContext wct = WebContextFactory.get();
	Util utilThis = new Util(wct.getScriptSession());
	utilThis.addScript(new ScriptBuffer("logOut()"));
}
 
开发者ID:wufeisoft,项目名称:ryf_mms2,代码行数:6,代码来源:MyDWRRemoter.java


注:本文中的org.directwebremoting.WebContext.getScriptSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。