@Override public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { processRequest(request, response); }
@Override public void doHelp(RenderRequest request, RenderResponse response) throws PortletException, IOException { String dispatchPage = getDispatchPage(request, HST_HELP_PAGE_PARAM_NAME, defaultHelpPage); if (!PortletConfigUtils.isEmpty(dispatchPage)) { try { request.setAttribute(ContainerConstants.HST_RESET_FILTER, Boolean.TRUE); dispatch(getPortletContext().getRequestDispatcher(dispatchPage), request, response, true); } catch (Exception e) { Logger logger = HstServices.getLogger(LOGGER_CATEGORY_NAME); if (logger != null) { logger.warn("Failed to dispatch page - {} : {}", dispatchPage, e); } } } else { processRequest(request, response); } }
protected void processRequest(PortletRequest request, PortletResponse response) throws PortletException, IOException { HstMutablePortletRequestContext prc = createHstRequestContext(request, response); if (prc != null) { HstPortalContextProvider pcp = getPortalContextProvider(request); if (pcp != null) { String portalContentPath = pcp.getContentPath(request); String hstDispUrl = getHstDispatchUrl(request, response, hstSiteMountPath, hstPathInfo, !portalContentPathBased); processActionResponseState((ActionRequest) request, (ActionResponse) response, hstDispUrl, portletResponseState); } else if (portletResponseState.isMimeResponse()) { ((RenderResponse) response).setTitle(portletTitle); processMimeResponseRequest(request, (MimeResponse) response, hstDispUrl, portletResponseState); } else { throw new PortletException("Unsupported Portlet lifecycle: " + request.getAttribute(PortletRequest.LIFECYCLE_PHASE));
@Override public void doHeaders(RenderRequest request, RenderResponse response) { String dispatchPage = getDispatchPage(request, HST_HEADER_PAGE_PARAM_NAME, defaultHeaderPage); if (!PortletConfigUtils.isEmpty(dispatchPage)) { try { dispatch(getPortletContext().getRequestDispatcher(dispatchPage), request, response, true); } catch (Exception e) { Logger logger = HstServices.getLogger(LOGGER_CATEGORY_NAME); if (logger != null) { logger.warn("Failed to dispatch page - {} : {}", dispatchPage, e); } } } }
@Override public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException { if (!PortletConfigUtils.isEmpty(request.getResourceID())) { // only handle serveResource by ResourceID parameter HstMutablePortletRequestContext prc = createHstRequestContext(request, response); if (prc != null) { HstPortletResponseState portletResponseState = new HstPortletResponseState(request, response); processMimeResponseRequest(request, response, request.getResourceID(), portletResponseState); } } }
protected void processActionResponseState(ActionRequest request, ActionResponse response, String hstDispUrl, HstPortletResponseState portletResponseState) throws PortletException, IOException { PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(hstDispUrl); if (dispatcher != null) { dispatch(dispatcher, request, response, true); // write out Cookies to ActionResponse portletResponseState.flush(); String redirectLocationUrl = portletResponseState.getRedirectLocation(); if (redirectLocationUrl != null) { if (portletResponseState.isRenderRedirect()) { response.setRenderParameter(HST_PATH_PARAM_NAME + request.getPortletMode().toString(), redirectLocationUrl); } else { response.sendRedirect(redirectLocationUrl); } } } else { throw new PortletException("HST URL Dispatcher is not found: " + hstDispUrl); } }
protected void processMimeResponseRequest(PortletRequest request, MimeResponse response, String hstDispUrl, HstPortletResponseState portletResponseState) throws PortletException, IOException { PortletRequestDispatcher dispatcher = this.portletContext.getRequestDispatcher(hstDispUrl); if (dispatcher != null) { dispatch(dispatcher, request, response, true); portletResponseState.flush(); } }
protected HstMutablePortletRequestContext createHstRequestContext(PortletRequest request, PortletResponse response) { HstMutablePortletRequestContext prc = null; if (HstServices.isAvailable()) { HstRequestContextComponent rcc = (HstRequestContextComponent)HstServices.getComponentManager().getComponent("org.hippoecm.hst.core.internal.HstRequestContextComponent"); prc = (HstMutablePortletRequestContext)rcc.create(true); prc.setContextNamespace(response.getNamespace()); prc.setPortletConfig(getPortletConfig()); prc.setPortletRequest(request); prc.setPortletResponse(response); request.setAttribute(ContainerConstants.HST_REQUEST_CONTEXT, prc); } return prc; }
@Override public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { processRequest(request, response); }
@Override public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { processRequest(request, response); }