001
014
015 package com.liferay.portlet.bookmarks.action;
016
017 import com.liferay.portal.kernel.util.ParamUtil;
018 import com.liferay.portal.struts.ActionConstants;
019 import com.liferay.portal.util.PortalUtil;
020 import com.liferay.portal.util.WebKeys;
021 import com.liferay.portlet.bookmarks.model.BookmarksEntry;
022 import com.liferay.portlet.bookmarks.service.BookmarksEntryServiceUtil;
023
024 import javax.servlet.http.HttpServletRequest;
025 import javax.servlet.http.HttpServletResponse;
026
027 import org.apache.struts.action.Action;
028 import org.apache.struts.action.ActionForm;
029 import org.apache.struts.action.ActionForward;
030 import org.apache.struts.action.ActionMapping;
031
032
035 public class OpenEntryAction extends Action {
036
037 @Override
038 public ActionForward execute(
039 ActionMapping actionMapping, ActionForm actionForm,
040 HttpServletRequest request, HttpServletResponse response)
041 throws Exception {
042
043 try {
044 long entryId = ParamUtil.getLong(request, "entryId");
045
046 BookmarksEntry entry = BookmarksEntryServiceUtil.openEntry(entryId);
047
048 request.setAttribute(WebKeys.FORWARD_URL, entry.getUrl());
049
050 return actionMapping.findForward(ActionConstants.COMMON_FORWARD);
051 }
052 catch (Exception e) {
053 PortalUtil.sendError(e, request, response);
054
055 return null;
056 }
057 }
058
059 }