List of usage examples for com.liferay.portal.kernel.servlet SessionMessages add
public static void add(PortletRequest portletRequest, String key, Object value)
From source file:com.liferay.portlet.layoutsadmin.action.EditLayoutsAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { try {// www . ja v a2 s . c o m checkPermissions(actionRequest); } catch (PrincipalException pe) { return; } ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String cmd = ParamUtil.getString(actionRequest, Constants.CMD); //Modification start SessionErrorsUtil.clear(actionRequest); SessionErrors.clear(actionRequest); //Modification end try { String redirect = ParamUtil.getString(actionRequest, "redirect"); String closeRedirect = ParamUtil.getString(actionRequest, "closeRedirect"); Layout layout = null; String oldFriendlyURL = StringPool.BLANK; if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) { Object[] returnValue = updateLayout(actionRequest, actionResponse); layout = (Layout) returnValue[0]; oldFriendlyURL = (String) returnValue[1]; redirect = updateCloseRedirect(redirect, null, layout, oldFriendlyURL); closeRedirect = updateCloseRedirect(closeRedirect, null, layout, oldFriendlyURL); } else if (cmd.equals(Constants.DELETE)) { Object[] returnValue = SitesUtil.deleteLayout(actionRequest, actionResponse); Group group = (Group) returnValue[0]; oldFriendlyURL = (String) returnValue[1]; long newRefererPlid = (Long) returnValue[2]; redirect = updateCloseRedirect(redirect, group, null, oldFriendlyURL); redirect = HttpUtil.setParameter(redirect, "refererPlid", newRefererPlid); // ===================== start of change https://jira.playtech.corp/browse/WPL-2040 redirect = HttpUtil.setParameter(redirect, actionResponse.getNamespace() + "selPlid", newRefererPlid); // ===================== end of change closeRedirect = updateCloseRedirect(closeRedirect, group, null, oldFriendlyURL); } else if (cmd.equals("copy_from_live")) { StagingUtil.copyFromLive(actionRequest); } else if (cmd.equals("display_order")) { updateDisplayOrder(actionRequest); } else if (cmd.equals("delete_layout_revision")) { deleteLayoutRevision(actionRequest); } else if (cmd.equals("enable")) { enableLayout(actionRequest); } else if (cmd.equals("publish_to_live")) { StagingUtil.publishToLive(actionRequest); } else if (cmd.equals("publish_to_remote")) { StagingUtil.publishToRemote(actionRequest); } else if (cmd.equals("reset_customized_view")) { LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet(); if ((layoutTypePortlet != null) && layoutTypePortlet.isCustomizable() && layoutTypePortlet.isCustomizedView()) { layoutTypePortlet.resetUserPreferences(); } } else if (cmd.equals("reset_prototype")) { SitesUtil.resetPrototype(themeDisplay.getLayout()); } else if (cmd.equals("schedule_copy_from_live")) { StagingUtil.scheduleCopyFromLive(actionRequest); } else if (cmd.equals("schedule_publish_to_live")) { StagingUtil.schedulePublishToLive(actionRequest); } else if (cmd.equals("schedule_publish_to_remote")) { StagingUtil.schedulePublishToRemote(actionRequest); } else if (cmd.equals("select_layout_set_branch")) { selectLayoutSetBranch(actionRequest); } else if (cmd.equals("select_layout_branch")) { selectLayoutBranch(actionRequest); } else if (cmd.equals("unschedule_copy_from_live")) { StagingUtil.unscheduleCopyFromLive(actionRequest); } else if (cmd.equals("unschedule_publish_to_live")) { StagingUtil.unschedulePublishToLive(actionRequest); } else if (cmd.equals("unschedule_publish_to_remote")) { StagingUtil.unschedulePublishToRemote(actionRequest); } else if (cmd.equals("update_layout_revision")) { updateLayoutRevision(actionRequest, themeDisplay); } if (Validator.isNotNull(closeRedirect)) { LiferayPortletConfig liferayPortletConfig = (LiferayPortletConfig) portletConfig; SessionMessages.add(actionRequest, liferayPortletConfig.getPortletId() + SessionMessages.KEY_SUFFIX_CLOSE_REDIRECT, closeRedirect); } sendRedirect(actionRequest, actionResponse, redirect); } catch (Exception e) { if (e instanceof NoSuchLayoutException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); setForward(actionRequest, "portlet.layouts_admin.error"); } else if (e instanceof ImageTypeException || e instanceof LayoutFriendlyURLException || e instanceof LayoutHiddenException || e instanceof LayoutNameException || e instanceof LayoutParentLayoutIdException || e instanceof LayoutSetVirtualHostException || e instanceof LayoutTypeException || e instanceof RequiredLayoutException || e instanceof UploadException) { if (e instanceof LayoutFriendlyURLException) { SessionErrors.add(actionRequest, LayoutFriendlyURLException.class.getName(), e); } else { SessionErrors.add(actionRequest, e.getClass(), e); } } else if (e instanceof DuplicateLockException || e instanceof LayoutPrototypeException || e instanceof RemoteExportException || e instanceof RemoteOptionsException || e instanceof SystemException) { SessionErrors.add(actionRequest, e.getClass(), e); String redirect = ParamUtil.getString(actionRequest, "pagesRedirect"); sendRedirect(actionRequest, actionResponse, redirect); } else { throw e; } } finally { SessionErrorsUtil.copyFromSessionErrors(actionRequest); } }
From source file:com.liferay.portlet.layoutsadmin.action.EditLayoutSetAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { try {//from w ww . j a va 2 s . co m checkPermissions(actionRequest); } catch (PrincipalException pe) { return; } String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try { if (cmd.equals(Constants.UPDATE)) { updateLayoutSet(actionRequest, actionResponse); } String closeRedirect = ParamUtil.getString(actionRequest, "closeRedirect"); if (Validator.isNotNull(closeRedirect)) { SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_CLOSE_REDIRECT, closeRedirect); } sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof PrincipalException || e instanceof SystemException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.layouts_admin.error"); } else if (e instanceof FileSizeException || e instanceof ImageTypeException || e instanceof UploadException) { SessionErrors.add(actionRequest, e.getClass().getName()); } else { throw e; } } }
From source file:com.liferay.portlet.login.action.CreateAccountAction.java
License:Open Source License
protected void addUser(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); HttpSession session = request.getSession(); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Company company = themeDisplay.getCompany(); boolean autoPassword = true; String password1 = null;//from w w w. ja v a 2 s . co m String password2 = null; boolean autoScreenName = isAutoScreenName(); String screenName = ParamUtil.getString(actionRequest, "screenName"); String emailAddress = ParamUtil.getString(actionRequest, "emailAddress"); long facebookId = ParamUtil.getLong(actionRequest, "facebookId"); String openId = ParamUtil.getString(actionRequest, "openId"); String firstName = ParamUtil.getString(actionRequest, "firstName"); String middleName = ParamUtil.getString(actionRequest, "middleName"); String lastName = ParamUtil.getString(actionRequest, "lastName"); int prefixId = ParamUtil.getInteger(actionRequest, "prefixId"); int suffixId = ParamUtil.getInteger(actionRequest, "suffixId"); boolean male = ParamUtil.getBoolean(actionRequest, "male", true); int birthdayMonth = ParamUtil.getInteger(actionRequest, "birthdayMonth"); int birthdayDay = ParamUtil.getInteger(actionRequest, "birthdayDay"); int birthdayYear = ParamUtil.getInteger(actionRequest, "birthdayYear"); String jobTitle = ParamUtil.getString(actionRequest, "jobTitle"); long[] groupIds = null; long[] organizationIds = null; long[] roleIds = null; long[] userGroupIds = null; boolean sendEmail = true; ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest); if (PropsValues.LOGIN_CREATE_ACCOUNT_ALLOW_CUSTOM_PASSWORD) { autoPassword = false; password1 = ParamUtil.getString(actionRequest, "password1"); password2 = ParamUtil.getString(actionRequest, "password2"); } boolean openIdPending = false; Boolean openIdLoginPending = (Boolean) session.getAttribute(WebKeys.OPEN_ID_LOGIN_PENDING); if ((openIdLoginPending != null) && (openIdLoginPending.booleanValue()) && (Validator.isNotNull(openId))) { sendEmail = false; openIdPending = true; } // check accountRole - numberPhone String accountRole = ParamUtil.getString(actionRequest, "accountRole", ""); String mobilePhone = ParamUtil.getString(actionRequest, "mobilePhone", ""); boolean subscriberAccount = false; if (accountRole.equals("subscriberAccount")) { subscriberAccount = true; if (!Validator.isPhoneNumber(mobilePhone)) { throw new Exception("mobile-phone-invalid"); } try { UserEntry tmpEmtry = UserEntryLocalServiceUtil.findByMobilePhone(mobilePhone); if (tmpEmtry != null) throw new Exception("mobile-phone-invalid"); } catch (Exception e) { // TODO: handle exception } } //accountRole User user = UserServiceUtil.addUserWithWorkflow(company.getCompanyId(), autoPassword, password1, password2, autoScreenName, screenName, emailAddress, facebookId, openId, themeDisplay.getLocale(), firstName, middleName, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext); if (openIdPending) { session.setAttribute(WebKeys.OPEN_ID_LOGIN, new Long(user.getUserId())); session.removeAttribute(WebKeys.OPEN_ID_LOGIN_PENDING); } else { // Session messages if (user.getStatus() == WorkflowConstants.STATUS_APPROVED) { SessionMessages.add(request, "user_added", user.getEmailAddress()); SessionMessages.add(request, "user_added_password", user.getPasswordUnencrypted()); } else { SessionMessages.add(request, "user_pending", user.getEmailAddress()); } } // ============================================================ // create user success - ok then create vrbt_user // add new UserEntry ( vrbt_user table ) UserEntry userEntry = null; try { userEntry = UserEntryLocalServiceUtil .createUserEntry(CounterLocalServiceUtil.increment(UserEntry.class.getName())); userEntry.setUserId(user.getUserId()); userEntry.setUserName(user.getScreenName()); userEntry.setGroupId(user.getGroupId()); userEntry.setCompanyId(user.getCompanyId()); userEntry.setCreateDate(Calendar.getInstance().getTime()); userEntry.setStatus(1); if (subscriberAccount) { userEntry.setMobilePhone(mobilePhone); } UserEntryLocalServiceUtil.updateUserEntry(userEntry); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } // add role long roleId = 0; try { Role role = null; if (subscriberAccount) { role = RoleLocalServiceUtil.getRole(PortalUtil.getCompanyId(request), "Subscriber"); if (role != null) roleId = role.getRoleId(); } else { role = RoleLocalServiceUtil.getRole(PortalUtil.getCompanyId(request), "Third-party"); if (role != null) roleId = role.getRoleId(); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } System.out.println("roleId:" + roleId); if (roleId > 0) { try { RoleLocalServiceUtil.addUserRoles(user.getUserId(), new long[] { roleId }); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } // ============================================================ // Send redirect String login = null; if (company.getAuthType().equals(CompanyConstants.AUTH_TYPE_ID)) { login = String.valueOf(user.getUserId()); } else if (company.getAuthType().equals(CompanyConstants.AUTH_TYPE_SN)) { login = user.getScreenName(); } else { login = user.getEmailAddress(); } // fix login = user.getScreenName(); // sendRedirect(actionRequest, actionResponse, themeDisplay, login, user.getPasswordUnencrypted()); }
From source file:com.liferay.portlet.login.action.CreateAccountAction.java
License:Open Source License
protected void updateIncompleteUser(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); boolean autoPassword = true; String password1 = null;/* w w w. j a v a 2 s .co m*/ String password2 = null; boolean autoScreenName = false; String screenName = ParamUtil.getString(actionRequest, "screenName"); String emailAddress = ParamUtil.getString(actionRequest, "emailAddress"); long facebookId = ParamUtil.getLong(actionRequest, "facebookId"); String openId = ParamUtil.getString(actionRequest, "openId"); String firstName = ParamUtil.getString(actionRequest, "firstName"); String middleName = ParamUtil.getString(actionRequest, "middleName"); String lastName = ParamUtil.getString(actionRequest, "lastName"); int prefixId = ParamUtil.getInteger(actionRequest, "prefixId"); int suffixId = ParamUtil.getInteger(actionRequest, "suffixId"); boolean male = ParamUtil.getBoolean(actionRequest, "male", true); int birthdayMonth = ParamUtil.getInteger(actionRequest, "birthdayMonth"); int birthdayDay = ParamUtil.getInteger(actionRequest, "birthdayDay"); int birthdayYear = ParamUtil.getInteger(actionRequest, "birthdayYear"); String jobTitle = ParamUtil.getString(actionRequest, "jobTitle"); boolean updateUserInformation = true; boolean sendEmail = true; ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest); User user = UserServiceUtil.updateIncompleteUser(themeDisplay.getCompanyId(), autoPassword, password1, password2, autoScreenName, screenName, emailAddress, facebookId, openId, themeDisplay.getLocale(), firstName, middleName, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, sendEmail, updateUserInformation, serviceContext); // Session messages if (user.getStatus() == WorkflowConstants.STATUS_APPROVED) { SessionMessages.add(request, "user_added", user.getEmailAddress()); SessionMessages.add(request, "user_added_password", user.getPasswordUnencrypted()); } else { SessionMessages.add(request, "user_pending", user.getEmailAddress()); } // Send redirect String login = null; Company company = themeDisplay.getCompany(); if (company.getAuthType().equals(CompanyConstants.AUTH_TYPE_ID)) { login = String.valueOf(user.getUserId()); } else if (company.getAuthType().equals(CompanyConstants.AUTH_TYPE_SN)) { login = user.getScreenName(); } else { login = user.getEmailAddress(); } sendRedirect(actionRequest, actionResponse, themeDisplay, login, user.getPasswordUnencrypted()); }
From source file:com.liferay.portlet.login.action.CreateAnonymousAccountAction.java
License:Open Source License
protected void addAnonymousUser(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); boolean autoPassword = true; String password1 = null;//from ww w .ja v a 2 s.com String password2 = null; boolean autoScreenName = true; String screenName = null; String emailAddress = ParamUtil.getString(actionRequest, "emailAddress"); long facebookId = 0; String openId = StringPool.BLANK; String firstName = ParamUtil.getString(actionRequest, "firstName"); String lastName = ParamUtil.getString(actionRequest, "lastName"); int prefixId = 0; int suffixId = 0; boolean male = true; int birthdayMonth = 0; int birthdayDay = 1; int birthdayYear = 1970; String jobTitle = null; long[] groupIds = null; long[] organizationIds = null; long[] roleIds = null; long[] userGroupIds = null; boolean sendEmail = false; ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest); serviceContext.setAttribute("anonymousUser", true); if (PropsValues.CAPTCHA_CHECK_PORTAL_CREATE_ACCOUNT) { CaptchaUtil.check(actionRequest); } User user = UserServiceUtil.addUser(themeDisplay.getCompanyId(), autoPassword, password1, password2, autoScreenName, screenName, emailAddress, facebookId, openId, themeDisplay.getLocale(), firstName, null, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext); UserLocalServiceUtil.updateStatus(user.getUserId(), WorkflowConstants.STATUS_INCOMPLETE); // Session messages SessionMessages.add(request, "user_added", user.getEmailAddress()); SessionMessages.add(request, "user_added_password", user.getPasswordUnencrypted()); }
From source file:com.liferay.portlet.login.action.OldCreateAccountAction.java
License:Open Source License
protected void addUser(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); HttpSession session = request.getSession(); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); Company company = themeDisplay.getCompany(); boolean autoPassword = true; String password1 = null;//from w w w .j ava 2 s . c o m String password2 = null; boolean autoScreenName = isAutoScreenName(); String screenName = ParamUtil.getString(actionRequest, "screenName"); String emailAddress = ParamUtil.getString(actionRequest, "emailAddress"); long facebookId = ParamUtil.getLong(actionRequest, "facebookId"); String openId = ParamUtil.getString(actionRequest, "openId"); String firstName = ParamUtil.getString(actionRequest, "firstName"); String middleName = ParamUtil.getString(actionRequest, "middleName"); String lastName = ParamUtil.getString(actionRequest, "lastName"); int prefixId = ParamUtil.getInteger(actionRequest, "prefixId"); int suffixId = ParamUtil.getInteger(actionRequest, "suffixId"); boolean male = ParamUtil.getBoolean(actionRequest, "male", true); int birthdayMonth = ParamUtil.getInteger(actionRequest, "birthdayMonth"); int birthdayDay = ParamUtil.getInteger(actionRequest, "birthdayDay"); int birthdayYear = ParamUtil.getInteger(actionRequest, "birthdayYear"); String jobTitle = ParamUtil.getString(actionRequest, "jobTitle"); long[] groupIds = null; long[] organizationIds = null; long[] roleIds = null; long[] userGroupIds = null; boolean sendEmail = true; ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest); if (PropsValues.LOGIN_CREATE_ACCOUNT_ALLOW_CUSTOM_PASSWORD) { autoPassword = false; password1 = ParamUtil.getString(actionRequest, "password1"); password2 = ParamUtil.getString(actionRequest, "password2"); } boolean openIdPending = false; Boolean openIdLoginPending = (Boolean) session.getAttribute(WebKeys.OPEN_ID_LOGIN_PENDING); if ((openIdLoginPending != null) && openIdLoginPending.booleanValue() && Validator.isNotNull(openId)) { sendEmail = false; openIdPending = true; } User user = UserServiceUtil.addUserWithWorkflow(company.getCompanyId(), autoPassword, password1, password2, autoScreenName, screenName, emailAddress, facebookId, openId, themeDisplay.getLocale(), firstName, middleName, lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext); if (openIdPending) { session.setAttribute(WebKeys.OPEN_ID_LOGIN, new Long(user.getUserId())); session.removeAttribute(WebKeys.OPEN_ID_LOGIN_PENDING); } else { // Session messages if (user.getStatus() == WorkflowConstants.STATUS_APPROVED) { SessionMessages.add(request, "user_added", user.getEmailAddress()); SessionMessages.add(request, "user_added_password", user.getPasswordUnencrypted()); } else { SessionMessages.add(request, "user_pending", user.getEmailAddress()); } } // Send redirect String login = null; if (company.getAuthType().equals(CompanyConstants.AUTH_TYPE_ID)) { login = String.valueOf(user.getUserId()); } else if (company.getAuthType().equals(CompanyConstants.AUTH_TYPE_SN)) { login = user.getScreenName(); } else { login = user.getEmailAddress(); } sendRedirect(actionRequest, actionResponse, themeDisplay, login, user.getPasswordUnencrypted()); }
From source file:com.liferay.portlet.login.util.LoginUtil.java
License:Open Source License
public static void sendPassword(ActionRequest actionRequest, String fromName, String fromAddress, String toAddress, String subject, String body) throws Exception { HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); Company company = themeDisplay.getCompany(); if (!company.isSendPassword() && !company.isSendPasswordResetLink()) { return;/*from w ww. j a va 2 s .c o m*/ } ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest); UserLocalServiceUtil.sendPassword(company.getCompanyId(), toAddress, fromName, fromAddress, subject, body, serviceContext); SessionMessages.add(actionRequest, "requestProcessed", toAddress); }
From source file:com.liferay.portlet.plugininstaller.action.InstallPluginAction.java
License:Open Source License
protected void reloadRepositories(ActionRequest actionRequest) throws Exception { RepositoryReport repositoryReport = PluginPackageUtil.reloadRepositories(); SessionMessages.add(actionRequest, WebKeys.PLUGIN_REPOSITORY_REPORT, repositoryReport); }
From source file:com.liferay.portlet.portletconfiguration.action.EditArchivedSetupsAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { Portlet portlet = null;/*w ww.java2s.c om*/ try { portlet = getPortlet(actionRequest); } catch (PrincipalException pe) { SessionErrors.add(actionRequest, PrincipalException.class.getName()); setForward(actionRequest, "portlet.portlet_configuration.error"); } String cmd = ParamUtil.getString(actionRequest, Constants.CMD); try { if (cmd.equals(Constants.SAVE)) { updateSetup(actionRequest, portlet); } else if (cmd.equals(Constants.RESTORE)) { restoreSetup(actionRequest, portlet); } else if (cmd.equals(Constants.DELETE)) { deleteSetup(actionRequest); } } catch (Exception e) { if (e instanceof NoSuchPortletItemException || e instanceof PortletItemNameException) { SessionErrors.add(actionRequest, e.getClass().getName()); sendRedirect(actionRequest, actionResponse); } else if (e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass().getName()); setForward(actionRequest, "portlet.portlet_configuration.error"); } else { throw e; } } if (SessionErrors.isEmpty(actionRequest)) { String portletResource = ParamUtil.getString(actionRequest, "portletResource"); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, portletResource); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_UPDATED_CONFIGURATION); String redirect = PortalUtil.escapeRedirect(ParamUtil.getString(actionRequest, "redirect")); if (Validator.isNotNull(redirect)) { actionResponse.sendRedirect(redirect); } } }
From source file:com.liferay.portlet.portletconfiguration.action.EditPublicRenderParametersAction.java
License:Open Source License
@Override public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { Portlet portlet = null;//w ww .j a va 2s .co m try { portlet = getPortlet(actionRequest); } catch (PrincipalException pe) { SessionErrors.add(actionRequest, PrincipalException.class.getName()); setForward(actionRequest, "portlet.portlet_configuration.error"); } updatePreferences(actionRequest, portlet); if (SessionErrors.isEmpty(actionRequest)) { String portletResource = ParamUtil.getString(actionRequest, "portletResource"); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET, portletResource); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_UPDATED_CONFIGURATION); String redirect = PortalUtil.escapeRedirect(ParamUtil.getString(actionRequest, "redirect")); if (Validator.isNotNull(redirect)) { actionResponse.sendRedirect(redirect); } } }