Examples of PortletRequestContext


Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

        // For now do nothing....
    }

    private String getKey(WebuiRequestContext webuiRC) {
        if (webuiRC instanceof PortletRequestContext) {
            PortletRequestContext portletRC = (PortletRequestContext) webuiRC;
            return portletRC.getApplication().getApplicationId() + "/" + portletRC.getWindowId();
        } else {
            return PortalApplication.PORTAL_APPLICATION_ID;
        }
    }
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

    }

    private HttpSession getSession(WebuiRequestContext webuiRC) {
        PortalRequestContext portalRC;
        if (webuiRC instanceof PortletRequestContext) {
            PortletRequestContext portletRC = (PortletRequestContext) webuiRC;
            portalRC = (PortalRequestContext) portletRC.getParentAppRequestContext();
        } else {
            portalRC = (PortalRequestContext) webuiRC;
        }
        HttpServletRequest req = portalRC.getRequest();
        return req.getSession(false);
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

*/
public class CaptchaValidator extends AbstractValidator implements Serializable {

    @Override
    protected boolean isValid(String value, UIFormInput uiInput) {
        PortletRequestContext ctx = PortletRequestContext.getCurrentInstance();
        PortletRequest req = ctx.getRequest();
        PortletSession session = req.getPortletSession();

        Captcha captcha = (Captcha) session.getAttribute(Captcha.NAME);

        return ((captcha != null) && (captcha.isCorrect(value)));
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

        // Never use captcha if skipCaptcha is true. Otherwise read value from portlet property
        boolean useCaptcha;
        if (skipCaptcha) {
            useCaptcha = false;
        } else {
            PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
            PortletPreferences pref = pcontext.getRequest().getPreferences();
            useCaptcha = Boolean.parseBoolean(pref.getValue(UIRegisterEditMode.USE_CAPTCHA, "true"));
        }

        if (useCaptcha) {
            addUIFormInput(new UICaptcha(CAPTCHA, CAPTCHA, null).addValidator(MandatoryValidator.class).addValidator(
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

@Serialized
public class UIRegisterEditMode extends UIForm {
    public static final String USE_CAPTCHA = "useCaptcha";

    public UIRegisterEditMode() {
        PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletPreferences pref = pcontext.getRequest().getPreferences();
        boolean useCaptcha = Boolean.parseBoolean(pref.getValue(USE_CAPTCHA, "true"));
        addUIFormInput(new UIFormCheckBoxInput<Boolean>(USE_CAPTCHA, USE_CAPTCHA, useCaptcha).setValue(useCaptcha));
    }
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

        @Override
        public void execute(Event<UIRegisterEditMode> event) throws Exception {
            // TODO Auto-generated method stub
            UIRegisterEditMode uiForm = event.getSource();
            boolean useCaptcha = uiForm.getUIFormCheckBoxInput(USE_CAPTCHA).isChecked();
            PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
            PortletPreferences pref = pcontext.getRequest().getPreferences();
            pref.setValue(USE_CAPTCHA, Boolean.toString(useCaptcha));
            pref.store();

            // Show/hide the captcha input in UIRegisterInputSet
            UIComponent registerPortlet = uiForm.getParent();
            UIRegisterInputSet registerInputSet = registerPortlet.findFirstComponentOfType(UIRegisterInputSet.class);

            if (useCaptcha) {
                if (!registerInputSet.getCaptchaInputAvailability()) {
                    registerInputSet.addUIFormInput(new UICaptcha(UIRegisterInputSet.CAPTCHA, UIRegisterInputSet.CAPTCHA, null)
                            .addValidator(MandatoryValidator.class).addValidator(CaptchaValidator.class));
                    registerInputSet.setCaptchaInputAvailability(true);
                }
            } else {
                if (registerInputSet.getCaptchaInputAvailability()) {
                    registerInputSet.removeChildById(UIRegisterInputSet.CAPTCHA);
                    registerInputSet.setCaptchaInputAvailability(false);
                }
            }

            UIPortalApplication portalApp = Util.getUIPortalApplication();
            if (portalApp.getModeState() == UIPortalApplication.NORMAL_MODE)
                pcontext.setApplicationMode(PortletMode.VIEW);

        }
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

        super.processAction(context);

        if (context.getProcessRender()) {
            // Invalidate the capcha
            if (context instanceof PortletRequestContext) {
                PortletRequestContext prc = (PortletRequestContext) context;
                prc.getRequest().getPortletSession().removeAttribute(Captcha.NAME);
            }
            context.addUIComponentToUpdateByAjax(getChild(UIRegisterInputSet.class));
        }
    }
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

                postRegistrationService.sendMailAfterSuccessfulRegistration(user);
            }

            // Invalidate the capcha
            if (context instanceof PortletRequestContext) {
                PortletRequestContext prc = (PortletRequestContext) context;
                prc.getRequest().getPortletSession().removeAttribute(Captcha.NAME);
            }
        }
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

    private final String windowId;

    private final String id;

    public UIGroovyPortlet() throws Exception {
        PortletRequestContext context = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletRequest prequest = context.getRequest();
        template_ = prequest.getPreferences().getValue("template", DEFAULT_TEMPLATE);
        windowId = prequest.getWindowID();
        id = windowId + "-portlet";
    }
View Full Code Here

Examples of org.exoplatform.webui.application.portlet.PortletRequestContext

@Serialized
public class UIApplicationRegistryEditMode extends UIForm {
    public static final String SHOW_IMPORT = "showImport";

    public UIApplicationRegistryEditMode() {
        PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletPreferences pref = pcontext.getRequest().getPreferences();
        boolean isShowImport = Boolean.parseBoolean(pref.getValue(SHOW_IMPORT, "true"));
        addUIFormInput(new UIFormCheckBoxInput<Boolean>(SHOW_IMPORT, SHOW_IMPORT, isShowImport).setValue(isShowImport));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.