Example usage for com.vaadin.server WrappedSession getAttribute

List of usage examples for com.vaadin.server WrappedSession getAttribute

Introduction

In this page you can find the example usage for com.vaadin.server WrappedSession getAttribute.

Prototype

public Object getAttribute(String name);

Source Link

Document

Gets an attribute from this session.

Usage

From source file:com.haulmont.cuba.web.AppUI.java

License:Apache License

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 {//w  w  w. ja v a2s. com
            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));
        }
    }
}

From source file:nl.kpmg.lcm.ui.rest.RestClientService.java

License:Apache License

private String retrieveLoginToken() {
    WrappedSession wrappedSession = VaadinService.getCurrentRequest().getWrappedSession();
    return (String) wrappedSession.getAttribute("loginToken");
}

From source file:nl.kpmg.lcm.ui.rest.RestClientService.java

License:Apache License

private String retrieveLoginUser() {
    WrappedSession wrappedSession = VaadinService.getCurrentRequest().getWrappedSession();
    return (String) wrappedSession.getAttribute("loginUser");
}

From source file:org.opencms.ui.error.CmsErrorUI.java

License:Open Source License

/**
 * Reads the error attributes from current session.<p>
 */// w ww  . jav a  2 s .co  m
private void readErrorAttributes() {

    WrappedSession session = getSession().getSession();
    m_requestedPage = (String) session.getAttribute(PATH);
    m_throwable = (Throwable) session.getAttribute(THROWABLE);

    // remove the attributes after read to keep the session clean
    session.removeAttribute(THROWABLE);
    session.removeAttribute(PATH);
}

From source file:org.vaadin.spring.security.internal.VaadinSharedSecurity.java

License:Apache License

@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 {//www .  j ava 2  s  .  c  o m
            logger.debug("No session bound to current thread, cannot retrieve the authentication object");
        }
    }
    return authentication;
}

From source file:org.vaadin.spring.security.shared.DefaultVaadinSharedSecurity.java

License:Apache License

@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 {//from  w w w .  j a  va  2 s. co m
            LOGGER.debug("No session bound to current thread, cannot retrieve the authentication object");
        }
    }
    return authentication;
}