本文整理匯總了Java中javax.portlet.ActionResponse.sendRedirect方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionResponse.sendRedirect方法的具體用法?Java ActionResponse.sendRedirect怎麽用?Java ActionResponse.sendRedirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.portlet.ActionResponse
的用法示例。
在下文中一共展示了ActionResponse.sendRedirect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionSaveGlobal
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
/**
* Saves the global aspect of the configuration
*
* @param request The request
* @param response The response
* @throws IOException If something goes wrong
* @throws PortletException If something goes wrong
*/
@ProcessAction(name = ACTION_NAME_SAVE_GLOBAL)
public void actionSaveGlobal(ActionRequest request, ActionResponse response) throws IOException, PortletException {
String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);
String adtUuid = ParamUtil.get(request, FORM_FIELD_ADT_UUID, StringPool.BLANK);
boolean doSearchOnStartup = ParamUtil.getBoolean(request, FORM_FIELD_DO_SEARCH_ON_STARTUP, false);
if (!PATTERN_UUID.matcher(adtUuid).matches()) {
adtUuid = StringPool.BLANK;
}
String doSearchOnStartupKeywords = ParamUtil.getString(request, FORM_FIELD_DO_SEARCH_ON_STARTUP_KEYWORDS, FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS);
this.searchService.saveGlobalSettings(adtUuid, doSearchOnStartup, doSearchOnStartupKeywords, request.getPreferences());
SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);
if (!redirectUrl.isEmpty()) {
response.sendRedirect(redirectUrl);
}
}
示例2: actionSaveFacetConfig
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
/**
* This action saves the Liferay facet configuration for a given tab
*
* @param request The request
* @param response The response
* @throws PortletException If something goes wrong
* @throws IOException If something goes wrong
*/
@ProcessAction(name = ACTION_NAME_SAVE_FACET_CONFIG)
public void actionSaveFacetConfig(ActionRequest request, ActionResponse response) throws PortletException, IOException {
String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK);
String facetClassName = ParamUtil.get(request, FORM_FIELD_FACET_CLASS_NAME, StringPool.BLANK);
String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);
PortletPreferences preferences = request.getPreferences();
FlashlightSearchConfiguration configuration = this.searchService.readConfiguration(preferences);
SearchFacet targetFacet = this.getSearchFacetFromRequest(tabId, facetClassName, configuration);
if(targetFacet != null) {
JSONObject facetConfiguration = targetFacet.getJSONData(request);
targetFacet.getFacetConfiguration().setDataJSONObject(facetConfiguration);
this.searchService.saveSearchFacetConfig(configuration.getTabs().get(tabId), targetFacet, preferences);
SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);
response.sendRedirect(redirectUrl);
}
}
示例3: actionDeleteTab
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
/**
* Deletes a tab from the configuration
*
* @param request The request
* @param response The response
* @throws PortletException If something goes wrong
* @throws IOException If something goes wrong
*/
@ProcessAction(name = ACTION_NAME_DELETE_TAB)
public void actionDeleteTab(ActionRequest request, ActionResponse response) throws PortletException, IOException {
String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK);
String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);
if (tabId != null && PATTERN_UUID.matcher(tabId).matches()) {
PortletPreferences preferences = request.getPreferences();
Map<String, FlashlightSearchConfigurationTab> tabs = this.searchService.readConfiguration(preferences).getTabs();
if (tabs.containsKey(tabId)) {
this.searchService.deleteConfigurationTab(tabId, preferences);
}
}
SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);
if (!redirectUrl.isEmpty()) {
response.sendRedirect(redirectUrl);
}
}
示例4: editactivity
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public void editactivity(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException, Exception {
long actId = ParamUtil.getInteger(actionRequest, "resId");
// LearningActivity learnact =
// com.liferay.lms.service.LearningActivityServiceUtil.getLearningActivity(actId);
LearningActivityAssetRendererFactory laf = new LearningActivityAssetRendererFactory();
if (laf != null) {
AssetRenderer assetRenderer = laf.getAssetRenderer(actId, 0);
String urlEdit = assetRenderer.getURLEdit((LiferayPortletRequest) actionRequest, (LiferayPortletResponse) actionResponse).toString();
Portlet urlEditPortlet =PortletLocalServiceUtil.getPortletById(HttpUtil.getParameter(urlEdit, "p_p_id",false));
if(urlEditPortlet!=null) {
PublicRenderParameter actIdPublicParameter = urlEditPortlet.getPublicRenderParameter("actId");
if(actIdPublicParameter!=null) {
urlEdit=HttpUtil.removeParameter(urlEdit,PortletQNameUtil.getPublicRenderParameterName(actIdPublicParameter.getQName()));
}
urlEdit=HttpUtil.addParameter(urlEdit, StringPool.UNDERLINE+urlEditPortlet.getPortletId()+StringPool.UNDERLINE+"resId", actId);
urlEdit=HttpUtil.removeParameter(urlEdit, StringPool.UNDERLINE+urlEditPortlet.getPortletId()+StringPool.UNDERLINE+"actionEditingDetails");
urlEdit=HttpUtil.addParameter(urlEdit, StringPool.UNDERLINE+urlEditPortlet.getPortletId()+StringPool.UNDERLINE+"actionEditingDetails", true);
}
actionResponse.sendRedirect(urlEdit);
}
SessionMessages.add(actionRequest, "asset-renderer-not-defined");
}
示例5: addEditAppRole
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public void addEditAppRole(ActionRequest request, ActionResponse response) throws SystemException, PortalException, IOException {
if (SessionErrors.isEmpty(request)) {
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
long applicationId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.APPLICATION_ID, PortletKeys.LONG_DEFAULT);
String roleCode = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_CODE, PortletKeys.TEXT_BOX);
String roleName = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_NAME, PortletKeys.TEXT_BOX);
Long editId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
if (editId == PortletKeys.LONG_DEFAULT) {
AppRoleLocalServiceUtil.addAppRole(applicationId, roleCode, roleName, serviceContext);
} else {
AppRoleLocalServiceUtil.updateAppRole(editId, applicationId, roleCode, roleName, serviceContext);
}
}
if (!SessionErrors.isEmpty(request)) {
PortalUtil.copyRequestParameters(request, response);
} else {
response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
}
}
示例6: processAction
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
@Override
public void processAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
try {
String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) {
updateFoo(actionRequest);
}
else if (cmd.equals(Constants.DELETE)) {
deleteFoo(actionRequest);
}
if (Validator.isNotNull(cmd)) {
if (SessionErrors.isEmpty(actionRequest)) {
SessionMessages.add(actionRequest, "requestProcessed");
}
String redirect = ParamUtil.getString(
actionRequest, "redirect");
actionResponse.sendRedirect(redirect);
}
}
catch (Exception e) {
throw new PortletException(e);
}
}
示例7: editactivity
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public void editactivity(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException, Exception {
long actId = ParamUtil.getInteger(actionRequest, "actId");
// LearningActivity learnact =
// com.liferay.lms.service.LearningActivityServiceUtil.getLearningActivity(actId);
AssetRendererFactory laf = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(LearningActivity.class.getName());
if (laf != null) {
AssetRenderer assetRenderer = laf.getAssetRenderer(actId, 0);
String urlEdit = assetRenderer.getURLEdit((LiferayPortletRequest) actionRequest, (LiferayPortletResponse) actionResponse).toString();
actionResponse.sendRedirect(urlEdit);
}
SessionMessages.add(actionRequest, "asset-renderer-not-defined");
}
示例8: delete
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public void delete(ActionRequest request, ActionResponse response)
throws PortalException, SystemException, IOException {
long deleteId = ParamUtil.getLong(request,
WorkingUnitKeys.BaseWorkingUnitAttributes.DELETE_ID,
PortletKeys.LONG_DEFAULT);
WorkingUnitLocalServiceUtil.removeWorkingUnit(deleteId);
response.sendRedirect(ParamUtil.getString(request,
PortletKeys.REDIRECT_PAGE));
}
示例9: listChucDanh
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public void listChucDanh(ActionRequest request, ActionResponse response)
throws PortalException, SystemException, IOException {
//long workingId = ParamUtil.getLong(request,
// WorkingUnitKeys.AddEditAttributes.WORKINGUNITID,
// PortletKeys.LONG_DEFAULT);
//
//WorkingUnitLocalServiceUtil.removeWorkingUnit(deleteId);
if (!SessionErrors.isEmpty(request)) {
response.sendRedirect(ParamUtil.getString(request,
PortletKeys.REDIRECT_PAGE));
} else {
PortalUtil.copyRequestParameters(request, response);
}
}
示例10: processAction
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public GenericBean processAction(ActionRequest request, ActionResponse response) throws Exception {
// Determine the project container to use
Project project = findProject(request);
if (project == null) {
throw new Exception("Project is null");
}
// Check the user's permissions
User user = getUser(request);
if (!user.isLoggedIn()) {
throw new PortletException("User needs to be logged in");
}
TeamMemberEmailBean emailBean = new TeamMemberEmailBean();
emailBean.setBody(request.getParameter("message"));
emailBean.setEnteredBy(user.getId());
emailBean.setProjectId(project.getId());
//Determine if the team member can send an email.
if (!ProjectUtils.hasAccess(project.getId(), user, "project-team-email")) {
throw new PortletException("Unauthorized to send email in this project");
}
if (!PortalUtils.hasMatchingFormToken(request)) {
throw new PortletException("Missing token");
}
// Validate the form
if (!StringUtils.hasText(emailBean.getBody())) {
emailBean.getErrors().put("messageError", "Message is required");
return emailBean;
}
// Send email notice
PortalUtils.processInsertHook(request, emailBean);
// Close the panel, everything went well
String ctx = request.getContextPath();
response.sendRedirect(ctx + "/close_panel_refresh.jsp");
return null;
}
示例11: processAction
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public GenericBean processAction(ActionRequest request, ActionResponse response) throws Exception {
// Determine the project container to use
Project project = findProject(request);
if (project == null) {
throw new Exception("Project is null");
}
// Check the user's permissions
User user = getUser(request);
if (!ProjectUtils.hasAccess(project.getId(), user, "project-wiki-admin")) {
throw new PortletException("Unauthorized to admin in this project");
}
// Parameters
String subject = getPageView(request);
// Find the record to update
Connection db = useConnection(request);
//Load the wiki page
Wiki wiki = WikiList.queryBySubject(db, subject, project.getId());
if (!wiki.getReadOnly()) {
wiki.lock(db);
}
// Redirect to another view
if ("true".equals(request.getParameter("popup"))) {
String ctx = request.getContextPath();
response.sendRedirect(ctx + "/projects_center_panel_refresh.jsp");
} else {
response.setRenderParameter("portlet-action", "show");
response.setRenderParameter("portlet-object", "wiki");
response.setRenderParameter("portlet-value", wiki.getSubjectLink());
}
return null;
}
示例12: editactivity
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public void editactivity(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, SystemException, Exception {
long actId = ParamUtil.getInteger(actionRequest, "actId");
LearningActivityAssetRendererFactory laf = new LearningActivityAssetRendererFactory();
if (laf != null) {
AssetRenderer assetRenderer = laf.getAssetRenderer(actId, 0);
String urlEdit = assetRenderer.getURLEdit((LiferayPortletRequest) actionRequest, (LiferayPortletResponse) actionResponse).toString();
actionResponse.sendRedirect(urlEdit);
}
SessionMessages.add(actionRequest, "asset-renderer-not-defined");
}
示例13: deleteAppRole
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public void deleteAppRole(ActionRequest request, ActionResponse response) throws PortalException, SystemException, IOException {
long deleteId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.DELETE_ID, PortletKeys.LONG_DEFAULT);
try {
AppRoleLocalServiceUtil.removeAppRole(deleteId);
SessionMessages.add(request, AppRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_SUCCESS_DELETE);
}
catch (Exception ex) {
SessionMessages.add(request, AppRoleKeys.ErrorMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_ERROR_DELETE);
}
response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
}
示例14: updateCourse
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
public void updateCourse(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception{
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
Course course=CourseLocalServiceUtil.fetchByGroupCreatedId(themeDisplay.getScopeGroupId());
Document document = SAXReaderUtil.read(course.getCourseExtraData());
Element rootElement = document.getRootElement();
Element firedDateElement = rootElement.element("firedDate");
if(firedDateElement==null){
rootElement.addElement("firedDate").setText(_dateFormat.format(new Date()));
course.setCourseExtraData(document.formattedString());
CourseLocalServiceUtil.updateCourse(course);
/*
Message message = new Message();
message.put("courseId", course.getCourseId());
MessageBusUtil.sendMessage("liferay/lms/evaluationAverage", message);
*/
CourseEval courseEval = new CourseEvalRegistry().getCourseEval(course.getCourseEvalId());
if(!courseEval.updateCourse(course)){
SessionErrors.add(actionRequest, "evaluationAvg.evaluation.error");
}
}
PortletURL viewPortletURL = ((LiferayPortletResponse)actionResponse).createRenderURL();
viewPortletURL.setParameter("jspPage","/html/evaluationAvg/view.jsp");
viewPortletURL.setParameter(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY,StringPool.TRUE);
String returnToFullPageURL = actionRequest.getParameter("returnToFullPageURL");
if(Validator.isNotNull(returnToFullPageURL)) {
viewPortletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
}
actionResponse.sendRedirect(viewPortletURL.toString());
}
示例15: doProcessAction
import javax.portlet.ActionResponse; //導入方法依賴的package包/類
@Override
protected void doProcessAction(
ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
ThemeDisplay themeDisplay =
(ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
HttpServletRequest request = PortalUtil.getOriginalServletRequest(
PortalUtil.getHttpServletRequest(actionRequest));
HttpServletResponse response =
PortalUtil.getHttpServletResponse(actionResponse);
String login = ParamUtil.getString(actionRequest, "login");
String password = ParamUtil.getString(actionRequest, "password");
String action = ParamUtil.getString(actionRequest, "action");
boolean rememberMe = ParamUtil.getBoolean(actionRequest, "rememberMe");
String authType = CompanyConstants.AUTH_TYPE_EA;
if (!Validator.isEmailAddress(login)) {
Applicant app = ApplicantLocalServiceUtil.fetchByAppId(login);
if (Validator.isNotNull(app)) {
login = app.getContactEmail();
}
}
Applicant applicant = UserMgtUtils.getApplicant(login);
login = applicant != null ? applicant.getContactEmail() : login;
User user = UserLocalServiceUtil.getUserByEmailAddress(
themeDisplay.getCompanyId(), login);
hideDefaultSuccessMessage(actionRequest);
if (user != null &&
user.getStatus() == WorkflowConstants.STATUS_PENDING) {
actionResponse.sendRedirect(
"/confirm-account?active_user_id=" + user.getUserId() +
"&redirectURL=" + themeDisplay.getURLCurrent());
}
else {
AuthenticatedSessionManagerUtil.login(
request, response, login, password, rememberMe, authType);
if (action != null && action.equals("confirm_account")) {
actionResponse.sendRedirect(
themeDisplay.getPortalURL() + "/profile");
}
else {
actionResponse.sendRedirect(themeDisplay.getPathMain());
}
}
}