Package org.jboss.dashboard.ui.controller

Examples of org.jboss.dashboard.ui.controller.RequestContext


        WorkspaceImpl currentWorkspace = (WorkspaceImpl) rqctx.getRequest().getRequestObject().getAttribute(CURRENT_WORKSPACE_ATTR);
        return currentWorkspace;
    }

    protected Section getCurrentPageFromCache() {
        RequestContext rqctx = RequestContext.getCurrentContext();
        Section currentPage = (Section) rqctx.getRequest().getRequestObject().getAttribute(CURRENT_PAGE_ATTR);
        return currentPage;
    }
View Full Code Here


     * subsequent calls to getCurrentWorkspace and getCurrentSection get the cached version.
     * Called just before rendering the page, as rendering shouldn't
     * modify navigation location
     */
    public void freezeNavigationStatus() {
        RequestContext rqctx = RequestContext.getCurrentContext();
        rqctx.getRequest().getRequestObject().setAttribute(CURRENT_WORKSPACE_ATTR, getCurrentWorkspace());
        rqctx.getRequest().getRequestObject().setAttribute(CURRENT_PAGE_ATTR, getCurrentSection());
    }
View Full Code Here

        processorChain.add(CDIBeanLocator.getBeanByType(EnvelopeVerifier.class));
    }

    public void run() throws Exception {
        for (RequestChainProcessor processor : processorChain) {
            RequestContext reqCtx = RequestContext.getCurrentContext();
            if (processor.processRequest(reqCtx.getRequest()) == false) {
                // Stop in case the processor has explicitly stopped the chain's processing.
                return;
            }
        }
    }
View Full Code Here

@ApplicationScoped @Install
public class SessionClearerUserStatusListener implements UserStatusListener {

    public void statusChanged(UserStatus us) {
        if (us.isAnonymous()) { // just logout
            RequestContext ctx = RequestContext.getCurrentContext();
            HttpSession session = ctx.getRequest().getSessionObject();
            Enumeration en = session.getAttributeNames();
            Set attributesToDelete = new HashSet();
            while (en.hasMoreElements()) {
                String attrName = (String) en.nextElement();
                Object obj = session.getAttribute(attrName);
                if (obj == null || !(obj instanceof LogoutSurvivor)) {
                    attributesToDelete.add(attrName);
                }
            }
            for (Iterator iterator = attributesToDelete.iterator(); iterator.hasNext();) {
                String attrName = (String) iterator.next();
                session.removeAttribute(attrName);
            }
            ctx.getRequest().getRequestObject().getSession().invalidate();
        }
    }
View Full Code Here

            log.warn("Ignoring page left for panel with dbid=" + getDbid());
            return;
        }
        if (getInstance() != null && !getInstance().isSessionAliveAfterPageLeft()) {
            PanelSession pSession = getPanelSession();
            RequestContext reqCtx = RequestContext.getCurrentContext();
            HttpSession session = reqCtx.getRequest().getSessionObject();
            pSession.clear();
            pSession.setWorkMode(PanelSession.SHOW_MODE);
            reqCtx.getRequest().getRequestObject().setAttribute(Parameters.RENDER_PANEL, this);
            getProvider().initSession(pSession, session);
            reqCtx.getRequest().getRequestObject().removeAttribute(Parameters.RENDER_PANEL);
        }
    }
View Full Code Here

        return l;
    }

    public int getDepthLevel() {
        // Section path number cache, to avoid lots of getParent() in the same request...
        RequestContext ctx = RequestContext.getCurrentContext();
        if (ctx == null || ctx.getRequest() == null) {
            return getPathNumber().size() - 1;
        }
        Map sectionsCache = (Map) ctx.getRequest().getRequestObject().getAttribute("sectionsPathNumberCache");
        if (sectionsCache == null)
            ctx.getRequest().getRequestObject().setAttribute("sectionsPathNumberCache", sectionsCache = new HashMap());

        List myPathNumber = (List) sectionsCache.get(this.getDbid());
        if (myPathNumber == null) {
            myPathNumber = getPathNumber();
            sectionsCache.put(this.getDbid(), myPathNumber);
View Full Code Here

        }
        return 0;
    }

    private void clearSectionsCache() {
        RequestContext ctx = RequestContext.getCurrentContext();
        if (ctx != null && ctx.getRequest() != null) {
            ctx.getRequest().getRequestObject().removeAttribute("sectionsPathNumberCache");
        }
    }
View Full Code Here

    public int compareTo(Object obj) {
        if (this == obj) return 0;
        Section section = (Section) obj;
        // Section path number cache, to avoid lots of getParent() in the same request...
        RequestContext ctx = RequestContext.getCurrentContext();
        if (ctx == null || ctx.getRequest() == null) {
            return comparePathNumbers(getPathNumber(), section.getPathNumber());
        }
        Map sectionsCache = (Map) ctx.getRequest().getRequestObject().getAttribute("sectionsPathNumberCache");
        if (sectionsCache == null)
            ctx.getRequest().getRequestObject().setAttribute("sectionsPathNumberCache", sectionsCache = new HashMap());

        List myPathNumber = (List) sectionsCache.get(this.getDbid());
        if (myPathNumber == null) {
            myPathNumber = getPathNumber();
            sectionsCache.put(this.getDbid(), myPathNumber);
View Full Code Here

     * Assume current workspace, section and panel.
     */
    public GraphicElement[] getAvailableElements() {
        Workspace workspace = NavigationManager.lookup().getCurrentWorkspace();
        Section section = NavigationManager.lookup().getCurrentSection();
        RequestContext reqCtx = RequestContext.getCurrentContext();
        Long idPanel = null;
        Panel panel = (Panel) reqCtx.getRequest().getRequestObject().getAttribute(Parameters.RENDER_PANEL);
        if (panel != null && section != null) {
            idPanel = panel.getPanelId();
            if (getElementScopeDescriptor().isAllowedInstance()) {
                idPanel = panel.getInstanceId();
            }
View Full Code Here

            log.warn("Ignoring page left for panel with dbid=" + getDbid());
            return;
        }
        if (!getInstance().isSessionAliveAfterPageLeft()) {
            PanelSession pSession = getPanelSession();
            RequestContext reqCtx = RequestContext.getCurrentContext();
            HttpSession session = reqCtx.getRequest().getSessionObject();
            pSession.clear();
            pSession.setWorkMode(PanelSession.SHOW_MODE);
            reqCtx.getRequest().getRequestObject().setAttribute(Parameters.RENDER_PANEL, this);
            getProvider().initSession(pSession, session);
            reqCtx.getRequest().getRequestObject().removeAttribute(Parameters.RENDER_PANEL);
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.ui.controller.RequestContext

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.