protected void doDispatch(String dispatchPath, HstRequest request, HstResponse response) throws HstComponentException { if (dispatchPath != null) { try { servletContext.getRequestDispatcher(dispatchPath).include(request, response); } catch (ServletException e) { throw new HstComponentException(e); } catch (IOException e) { throw new HstComponentException(e); } } else { if (log.isDebugEnabled()) { log.debug("The dispatch path is null. The lifecycle phase is {} and the dispatch lifecycle phase is {}", request.getLifecyclePhase(), request.getAttribute(LIFECYCLE_PHASE_ATTRIBUTE)); } } }
protected void doDispatch(String dispatchPath, HstRequest request, HstResponse response) throws HstComponentException { if (dispatchPath != null) { try { getServletContext().getRequestDispatcher(dispatchPath).include(request, response); } catch (ServletException e) { throw new HstComponentException(e); } catch (IOException e) { throw new HstComponentException(e); } } else { if (log.isDebugEnabled()) { log.debug("The dispatch path is null. The lifecycle phase is {} and the dispatch lifecycle phase is {}", request.getLifecyclePhase(), request.getAttribute(LIFECYCLE_PHASE_ATTRIBUTE)); } } }
@Override public void doAction(HstRequest request, HstResponse response) throws HstComponentException { doDispatch(getDispatchPathParameter(request, request.getLifecyclePhase()), request, response); if (Boolean.parseBoolean(getParameter(SHARED_REQUEST_ATTRIBUTES_PARAM_NAME, request, null))) { String sharedAttributeNamePrefix = getParameter(SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX_PARAM_NAME, request, DEFAULT_SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX); String sharedAttributeName = sharedAttributeNamePrefix + response.getNamespace(); Map<String, Object> sharedAttrMap = new HashMap<String, Object>(); String attrName = null; Object attrValue = null; for (Enumeration attrNames = request.getAttributeNames(); attrNames.hasMoreElements(); ) { attrName = (String) attrNames.nextElement(); if (!attrName.startsWith("javax.")) { attrValue = request.getAttribute(attrName); if (attrValue != null) { sharedAttrMap.put(attrName, attrValue); } } } request.getSession(true).setAttribute(sharedAttributeName, sharedAttrMap); } }
@Override public void doAction(HstRequest request, HstResponse response) throws HstComponentException { doDispatch(getDispatchPathParameter(request, request.getLifecyclePhase()), request, response); if (Boolean.parseBoolean(getParameter(SHARED_REQUEST_ATTRIBUTES_PARAM_NAME, request, null))) { String sharedAttributeNamePrefix = getParameter(SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX_PARAM_NAME, request, DEFAULT_SHARED_REQUEST_ATTRIBUTES_SESSION_ATTRIBUTE_NAME_PREFIX); String sharedAttributeName = sharedAttributeNamePrefix + response.getNamespace(); Map<String, Object> sharedAttrMap = new HashMap<String, Object>(); String attrName = null; Object attrValue = null; for (Enumeration attrNames = request.getAttributeNames(); attrNames.hasMoreElements(); ) { attrName = (String) attrNames.nextElement(); if (!attrName.startsWith("javax.")) { attrValue = request.getAttribute(attrName); if (attrValue != null) { sharedAttrMap.put(attrName, attrValue); } } } request.getSession(true).setAttribute(sharedAttributeName, sharedAttrMap); } }
HstRequest hstRequest = HstRequestUtils.getHstRequest(request); boolean isActionPhase = (hstRequest != null && HstRequest.ACTION_PHASE.equals(hstRequest.getLifecyclePhase())); boolean renderable = true; String modelAndViewOfActionSessionAttributeName = getModelAndViewOfActionSessionAttributeName(hstRequest);
HstRequest hstRequest = HstRequestUtils.getHstRequest(request); boolean isActionPhase = (hstRequest != null && HstRequest.ACTION_PHASE.equals(hstRequest.getLifecyclePhase())); boolean renderable = true; String modelAndViewOfActionSessionAttributeName = getModelAndViewOfActionSessionAttributeName(hstRequest);
if (RESOURCE_PHASE.equals(request.getLifecyclePhase())) { log.debug("During {} a request does not (yet) support set render parameter. Skipping setting render parameter", RESOURCE_PHASE); } else {
if (HstRequest.ACTION_PHASE.equals(request.getLifecyclePhase()) || !request.getRequestContext().isPortletContext()) { sendRedirect(request, response, path, queryParams, characterEncoding); } else {
request.setAttribute(LIFECYCLE_PHASE_ATTRIBUTE, BEFORE_RENDER_PHASE); String dispatchPath = getDispatchPathParameter(request, request.getLifecyclePhase());
request.setAttribute(LIFECYCLE_PHASE_ATTRIBUTE, BEFORE_RENDER_PHASE); String dispatchPath = getDispatchPathParameter(request, request.getLifecyclePhase());
@Override public void doBeforeServeResource(HstRequest request, HstResponse response) throws HstComponentException { super.doBeforeServeResource(request, response); request.setAttribute(LIFECYCLE_PHASE_ATTRIBUTE, BEFORE_RESOURCE_PHASE); String dispatchPath = getDispatchPathParameter(request, request.getLifecyclePhase()); if (dispatchPath != null) { response.setServeResourcePath(dispatchPath); } try { doDispatch(getDispatchPathParameter(request, BEFORE_RESOURCE_PHASE), request, response); } finally { request.removeAttribute(LIFECYCLE_PHASE_ATTRIBUTE); } }
@Override public void doBeforeServeResource(HstRequest request, HstResponse response) throws HstComponentException { super.doBeforeServeResource(request, response); request.setAttribute(LIFECYCLE_PHASE_ATTRIBUTE, BEFORE_RESOURCE_PHASE); String dispatchPath = getDispatchPathParameter(request, request.getLifecyclePhase()); if (dispatchPath != null) { response.setServeResourcePath(dispatchPath); } try { doDispatch(getDispatchPathParameter(request, BEFORE_RESOURCE_PHASE), request, response); } finally { request.removeAttribute(LIFECYCLE_PHASE_ATTRIBUTE); } }