List of usage examples for com.liferay.portal.kernel.util WebKeys BLOGS_ENTRY
String BLOGS_ENTRY
To view the source code for com.liferay.portal.kernel.util WebKeys BLOGS_ENTRY.
Click Source Link
From source file:com.liferay.blogs.web.asset.BlogsEntryAssetRenderer.java
License:Open Source License
@Override public boolean include(HttpServletRequest request, HttpServletResponse response, String template) throws Exception { request.setAttribute(WebKeys.BLOGS_ENTRY, _entry); return super.include(request, response, template); }
From source file:com.liferay.blogs.web.internal.portlet.action.ActionUtil.java
License:Open Source License
public static void getEntry(PortletRequest portletRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); long entryId = ParamUtil.getLong(portletRequest, "entryId"); String urlTitle = ParamUtil.getString(portletRequest, "urlTitle"); BlogsEntry entry = null;//ww w . j av a 2 s .c o m if (entryId > 0) { entry = BlogsEntryServiceUtil.getEntry(entryId); } else if (Validator.isNotNull(urlTitle) && SessionErrors.isEmpty(portletRequest)) { try { entry = BlogsEntryServiceUtil.getEntry(themeDisplay.getScopeGroupId(), urlTitle); } catch (NoSuchEntryException nsee) { if (urlTitle.indexOf(CharPool.UNDERLINE) != -1) { // Check another URL title for backwards compatibility. See // LEP-5733. urlTitle = StringUtil.replace(urlTitle, CharPool.UNDERLINE, CharPool.DASH); entry = BlogsEntryServiceUtil.getEntry(themeDisplay.getScopeGroupId(), urlTitle); } else { throw nsee; } } } if ((entry != null) && entry.isInTrash()) { throw new NoSuchEntryException("{entryId=" + entryId + "}"); } HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest); request.setAttribute(WebKeys.BLOGS_ENTRY, entry); }
From source file:com.liferay.blogs.web.internal.portlet.action.TrackbackMVCActionCommand.java
License:Open Source License
protected BlogsEntry getBlogsEntry(ActionRequest actionRequest) throws Exception { try {//www. j av a 2 s .c o m ActionUtil.getEntry(actionRequest); } catch (PrincipalException pe) { throw new TrackbackValidationException( "Blog entry must have guest view permissions to enable " + "trackbacks", pe); } return (BlogsEntry) actionRequest.getAttribute(WebKeys.BLOGS_ENTRY); }
From source file:com.liferay.blogs.web.internal.portlet.action.TrackbackMVCActionCommandTest.java
License:Open Source License
protected void setUpActionRequest() { when(_actionRequest.getAttribute(WebKeys.THEME_DISPLAY)).thenReturn(_themeDisplay); when(_actionRequest.getPreferences()).thenReturn(_portletPreferences); when(_actionRequest.getAttribute(WebKeys.BLOGS_ENTRY)).thenReturn(_blogsEntry); }
From source file:com.liferay.blogs.web.internal.portlet.action.ViewEntryMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException { long assetCategoryId = ParamUtil.getLong(renderRequest, "categoryId"); String assetCategoryName = ParamUtil.getString(renderRequest, "tag"); if ((assetCategoryId > 0) || Validator.isNotNull(assetCategoryName)) { return "/blogs/view.jsp"; }// www .j ava 2 s.com try { ActionUtil.getEntry(renderRequest); if (PropsValues.BLOGS_PINGBACK_ENABLED) { BlogsEntry entry = (BlogsEntry) renderRequest.getAttribute(WebKeys.BLOGS_ENTRY); if ((entry != null) && entry.isAllowPingbacks()) { HttpServletResponse response = PortalUtil.getHttpServletResponse(renderResponse); response.addHeader("X-Pingback", PortalUtil.getPortalURL(renderRequest) + "/xmlrpc/pingback"); } } } catch (Exception e) { if (e instanceof NoSuchEntryException || e instanceof PrincipalException) { SessionErrors.add(renderRequest, e.getClass()); return "/blogs/error.jsp"; } else { throw new PortletException(e); } } return "/blogs/view_entry.jsp"; }