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


Java WrappedSession.getAttribute方法代码示例

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


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

示例1: processExternalLink

import com.vaadin.server.WrappedSession; //导入方法依赖的package包/类
public void processExternalLink(VaadinRequest request) {
    WrappedSession wrappedSession = request.getWrappedSession();

    String action = (String) wrappedSession.getAttribute(LAST_REQUEST_ACTION_ATTR);

    if (webConfig.getLinkHandlerActions().contains(action)) {
        //noinspection unchecked
        Map<String, String> params =
                (Map<String, String>) wrappedSession.getAttribute(LAST_REQUEST_PARAMS_ATTR);
        params = params != null ? params : Collections.emptyMap();

        try {
            LinkHandler linkHandler = AppBeans.getPrototype(LinkHandler.NAME, app, action, params);
            if (app.connection.isConnected() && linkHandler.canHandleLink()) {
                linkHandler.handle();
            } else {
                app.linkHandler = linkHandler;
            }
        } catch (Exception e) {
            error(new com.vaadin.server.ErrorEvent(e));
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:AppUI.java

示例2: doDispatch

import com.vaadin.server.WrappedSession; //导入方法依赖的package包/类
private void doDispatch(final List<TenantAwareEvent> events, final WrappedSession wrappedSession) {
    final SecurityContext userContext = (SecurityContext) wrappedSession
            .getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
    final SecurityContext oldContext = SecurityContextHolder.getContext();
    try {
        SecurityContextHolder.setContext(userContext);

        final List<EventContainer<TenantAwareEvent>> groupedEvents = groupEvents(events, userContext,
                eventProvider);

        vaadinUI.access(() -> {
            if (vaadinSession.getState() != State.OPEN) {
                return;
            }
            LOG.debug("UI EventBus aggregator of UI {} got lock on session.", vaadinUI.getUIId());
            groupedEvents.forEach(holder -> eventBus.publish(vaadinUI, holder));
            LOG.debug("UI EventBus aggregator of UI {} left lock on session.", vaadinUI.getUIId());
        }).get();
    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("Wait for Vaadin session for UI {} interrupted!", vaadinUI.getUIId(), e);
    } finally {
        SecurityContextHolder.setContext(oldContext);
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:25,代码来源:DelayedEventBusPushStrategy.java

示例3: getAuthentication

import com.vaadin.server.WrappedSession; //导入方法依赖的package包/类
@Override
public Authentication getAuthentication() {
    final SecurityContext securityContext = SecurityContextHolder.getContext();
    Authentication authentication = securityContext.getAuthentication();

    if (authentication == null) {
        // The SecurityContextHolder only holds the Authentication when it is
        // processing the securityFilterChain. After it completes the chain
        // it clears the context holder.

        // Therefore, the Authentication object can be retrieved from the
        // location where the securityFilterChain or VaadinSecurity has left it,
        // within the HttpSession.
        LOGGER.debug("No authentication object bound to thread, trying to access the session directly");
        WrappedSession session = getSession();
        if (session != null) {
            SecurityContext context = (SecurityContext) session.getAttribute(springSecurityContextKey);
            authentication = context.getAuthentication();
        } else {
            LOGGER.debug("No session bound to current thread, cannot retrieve the authentication object");
        }
    }
    return authentication;
}
 
开发者ID:peholmst,项目名称:vaadin4spring,代码行数:25,代码来源:DefaultVaadinSharedSecurity.java

示例4: processExternalLink

import com.vaadin.server.WrappedSession; //导入方法依赖的package包/类
@Override
public void processExternalLink(VaadinRequest request) {
    WrappedSession wrappedSession = request.getWrappedSession();
    String action = (String) wrappedSession.getAttribute(LAST_REQUEST_ACTION_ATTR);
    if (NexbitLinkHandler.RESET_ACTION.equals(action)) {
        //noinspection unchecked
        Map<String, String> params =
                (Map<String, String>) wrappedSession.getAttribute(LAST_REQUEST_PARAMS_ATTR);
        if (params == null) {
            log.warn("Unable to process the external link: lastRequestParams not found in session");
            return;
        }

        try {
            LinkHandler linkHandler = AppBeans.getPrototype(LinkHandler.NAME, app, action, params);
            if (((NexbitLinkHandler)linkHandler).canHandleLink(action, params)) {
                linkHandler.handle();
                wrappedSession.setAttribute(LAST_REQUEST_ACTION_ATTR, null);
                return;
            }
        } catch (Exception e) {
            error(new com.vaadin.server.ErrorEvent(e));
        }
    }

    super.processExternalLink(request);
}
 
开发者ID:pfurini,项目名称:cuba-component-forgot-password,代码行数:28,代码来源:NexbitAppUI.java


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