Package org.apache.jetspeed.request

Examples of org.apache.jetspeed.request.RequestContext


                viewLink.setPopupSettings(new PopupSettings());
                infoForm.add(viewLink);
            }
            else
            {
                RequestContext context = (RequestContext) getPortletRequest().getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
                String basePath = context.getPortalURL().getBasePath().replace("portal", "configure");
                ExternalLink viewLink = new ExternalLink("view", new Model(basePath + getDocument().getPath()), new ResourceModel("common.view"))
                {
                    @Override
                    protected void onComponentTag(ComponentTag tag)
                    {
View Full Code Here


        if (themes != null)
        {
            return themes;
        }
        themes = new ArrayList<ThemeBean>();
        RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);           
        Set<String> decorators = (Set<String>)decorationFactory.getPageDecorations(rc);
        for (String name : decorators)
        {
            LayoutDecoration decor = decorationFactory.getLayoutDecoration(name, rc);
            String compatibility = decor.getProperty("compatibility");
            if (compatibility != null && compatibility.compareTo("2.2.1") >= 0)
            {
                ResourceBundle rb = decor.getResourceBundle(rc.getLocale(), rc);
                String title = null;
                try
                {
                    title = rb.getString("title");
                }
                catch(Exception e)
                {}
                if (title == null)
                    title = decor.getName();
                String icon = decor.getProperty("icon");
                if (icon == null)
                {
                    icon = "";
                }
                ThemeBean theme = new ThemeBean(decor.getName(), title, icon);               
                Theme pageTheme = (Theme)rc.getRequest().getAttribute("org.apache.jetspeed.theme");
                if (overrideTheme == null)
                  overrideTheme = pageTheme.getPageLayoutDecoration().getName();
                if (overrideTheme.equals(decor.getName()))
                    theme.setSelected(true);
                themes.add(theme);
View Full Code Here

        return themes;
    }

    public static String getDefaultTheme(PortletRequest request, DecorationFactory decorationFactory)
    {
        RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);           
      Set<String> decorators = (Set<String>)decorationFactory.getPageDecorations(rc);
        for (String name : decorators)
        {
            LayoutDecoration decor = decorationFactory.getLayoutDecoration(name, rc);
            String compatibility = decor.getProperty("compatibility");
View Full Code Here

    {
        response.setContentType("text/html");

        if ( request.getUserPrincipal() != null )
        {
            RequestContext requestContext = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
            Integer passwordDaysValid = (Integer)requestContext.getAttribute(PasswordCredential.PASSWORD_CREDENTIAL_DAYS_VALID_REQUEST_ATTR_KEY);
           
            if ( passwordDaysValid != null )
            {
                ResourceBundle bundle = ResourceBundle.getBundle("org.apache.jetspeed.portlets.security.resources.ChgPwdResources",request.getLocale());
                if ( passwordDaysValid.intValue() < 1 )
View Full Code Here

    }

    public void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException
    {   
        RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);

        List<BreadcrumbMenuItem> breadcrumbs = new LinkedList<BreadcrumbMenuItem>();
        try
        {
            Locale preferredLocale = rc.getLocale();
            PortalSiteRequestContext siteRequestContext = (PortalSiteRequestContext)rc.getAttribute(PORTAL_SITE_REQUEST_CONTEXT_ATTR_KEY);
            Menu breadcrumbsMenu = siteRequestContext.getMenu("breadcrumbs");
            if (breadcrumbsMenu != null)
            {
                List<MenuElement> breadcrumbsMenuElements = breadcrumbsMenu.getElements();
                if (breadcrumbsMenuElements != null)
View Full Code Here

                      credential.setPassword(currPassword, newPassword);
                      manager.storePasswordCredential(credential);
                        audit.logUserActivity(userName, getIPAddress(actionRequest), AuditActivity.PASSWORD_CHANGE_SUCCESS, USER_ADMINISTRATION);

                        // update Subject in session to reflect the changed PasswordCredential
                        RequestContext requestContext = (RequestContext)actionRequest.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);                 
                        Subject subject = (Subject)requestContext.getSessionAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT);
                        Iterator<Object> iter = subject.getPrivateCredentials().iterator();
                        while (iter.hasNext())
                        {
                            Object o = iter.next();
                            if (o instanceof UserCredential)
View Full Code Here

        }
    }

    protected String getIPAddress(PortletRequest request)
    {
        RequestContext context = (RequestContext)request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
        if (context == null)
            return "";
        return context.getRequest().getRemoteAddr();
    }
View Full Code Here

    }
   
    @Override
    protected void doHeaders(RenderRequest request, RenderResponse response) {
        super.doHeaders(request, response);
        RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
        Element headElem = response.createElement("script");
        headElem.setAttribute("language", "javascript");
        String scriptPath = rc.getRequest().getContextPath() + yuiScriptPath;
        headElem.setAttribute("id", HeaderPhaseSupportConstants.HEAD_ELEMENT_CONTRIBUTION_ELEMENT_ID_YUI_LIBRARY_INCLUDE);
        headElem.setAttribute("src", scriptPath);
        headElem.setAttribute("type", "text/javascript");
        response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, headElem);
    }
View Full Code Here

       
        boolean hasEditAccess = false;
       
        try
        {
            RequestContext requestContext = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
            ContentPage contentPage = requestContext.getPage();
            contentPage.checkAccess(JetspeedActions.EDIT);
            hasEditAccess = true;
        }
        catch(Exception ignore)
        {
View Full Code Here

    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException,
    IOException
    {
        String theme =  actionRequest.getParameter("theme");
        String layout =  actionRequest.getParameter("layout");
        RequestContext requestContext = (RequestContext) actionRequest.getAttribute(RequestContext.REQUEST_PORTALENV);
       
        if (theme != null)
        {
            try
            {
                ContentPage page = requestContext.getPage();
                pageLayoutComponent.updateDefaultDecorator(page, theme, ContentFragment.LAYOUT);
                pageLayoutComponent.updateDefaultDecorator(page, theme, ContentFragment.LAYOUT);
                actionRequest.getPortletSession().removeAttribute("themes");
            }
            catch (Exception e)
            {
                log.error("Page has not been updated.", e);
            }           
        }
       
        if (layout != null)
        {
            try
            {
                ContentFragment layoutFragment = requestContext.getPage().getNonTemplateRootFragment();
                pageLayoutComponent.updateName(layoutFragment, layout);
                actionRequest.getPortletSession().removeAttribute("layouts");
            }
            catch (Exception e)
            {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.request.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.