Package org.jboss.dashboard.ui.controller

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


    /**
     * @deprecated Use LocaleManager instead
     */
    public static Locale getCurrentLocale() {
        RequestContext reqCtx = RequestContext.getCurrentContext();
        String defaultLang = reqCtx.getRequest().getRequestObject().getParameter(Parameters.FORCE_LANGUAGE);
        LocaleManager localeManager = LocaleManager.lookup();
        if (defaultLang != null) localeManager.setCurrentLang(defaultLang);
        return localeManager.getCurrentLocale();
    }
View Full Code Here


    /**
     * @deprecated Use LocaleManager instead
     */
    public static String getLang() {
        RequestContext reqCtx = RequestContext.getCurrentContext();
        String defaultLang = reqCtx.getRequest().getRequestObject().getParameter(Parameters.FORCE_LANGUAGE);
        LocaleManager localeManager = LocaleManager.lookup();
        if (defaultLang != null) localeManager.setCurrentLang(defaultLang);
        return localeManager.getCurrentLang();
    }
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

        PanelInstance instance = getPanel().getInstance();
        try {
            // IMPORTANT NOTE: make sure HTTP session is initialized before
            // invoking PanelProvider.initSession()
            this.session = session;
            RequestContext reqCtx = RequestContext.getCurrentContext();
            reqCtx.getRequest().getRequestObject().setAttribute(Parameters.RENDER_PANEL, getPanel());
            if (instance != null) instance.getProvider().initSession(this, session);
        } catch (Exception e) {
            String providerStr = "";
            if (instance != null) providerStr = " Provider: " + instance.getProvider().getId();
            log.error("Error initializing panel status: " + getPanel().getPanelId() + providerStr, e);
View Full Code Here

        if (!(panel.getInstance().getProvider().getDriver().getClass().getName().contains("DashboardFilterDriver"))) return null;

        String code = panel.getParameterValue(FILTER_HANDLER_CODE);

        // If no request context exists then do a standard lookup.
        RequestContext reqCtx = RequestContext.getCurrentContext();
        if (reqCtx == null) return DashboardFilterHandler.lookup(code);

        // Save the current panel instance and set the specified panel as current.
        HttpServletRequest httpReq = reqCtx.getRequest().getRequestObject();
        Panel currentPanel = (Panel) httpReq.getAttribute(Parameters.RENDER_PANEL);
        httpReq.setAttribute(Parameters.RENDER_PANEL, panel);

        // Get the handler component within the scope of the specified panel
        try {
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

            log.error("Error: ", e);
        }
    }

    protected void clearRequestCache() {
        RequestContext rqctx = RequestContext.getCurrentContext();
        rqctx.getRequest().getRequestObject().removeAttribute(CURRENT_WORKSPACE_ATTR);
        rqctx.getRequest().getRequestObject().removeAttribute(CURRENT_PAGE_ATTR);
    }
View Full Code Here

        rqctx.getRequest().getRequestObject().removeAttribute(CURRENT_WORKSPACE_ATTR);
        rqctx.getRequest().getRequestObject().removeAttribute(CURRENT_PAGE_ATTR);
    }

    protected WorkspaceImpl getCurrentWorkspaceFromCache() {
        RequestContext rqctx = RequestContext.getCurrentContext();
        WorkspaceImpl currentWorkspace = (WorkspaceImpl) rqctx.getRequest().getRequestObject().getAttribute(CURRENT_WORKSPACE_ATTR);
        return currentWorkspace;
    }
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.