コード例 #1
0
  protected void include(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    // Call render of com.liferay.portal.struts.PortletAction

    Map<String, Object> strutsAttributes = null;

    if (_portletConfig.isWARFile()) {
      strutsAttributes = StrutsUtil.removeStrutsAttributes(getPortletContext(), renderRequest);
    }

    try {
      PortletRequestProcessor processor = _getPortletRequestProcessor();

      processor.process(renderRequest, renderResponse);
    } catch (ServletException se) {
      throw new PortletException(se);
    } finally {
      if (_portletConfig.isWARFile()) {
        StrutsUtil.setStrutsAttributes(renderRequest, strutsAttributes);
      }
    }

    if (copyRequestParameters) {
      PortalUtil.clearRequestParameters(renderRequest);
    }
  }
コード例 #2
0
  @Override
  public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
      throws IOException, PortletException {

    resourceRequest.setAttribute(WebKeys.PORTLET_STRUTS_ACTION, viewAction);

    // Call serveResource of com.liferay.portal.struts.PortletAction

    try {
      PortletRequestProcessor processor = _getPortletRequestProcessor();

      processor.process(resourceRequest, resourceResponse);
    } catch (ServletException se) {
      throw new PortletException(se);
    }
  }
コード例 #3
0
  @Override
  public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
      throws IOException, PortletException {

    String path = actionRequest.getParameter("struts_action");

    if (Validator.isNotNull(path)) {

      // Call processAction of com.liferay.portal.struts.PortletAction

      try {
        PortletRequestProcessor processor = _getPortletRequestProcessor();

        processor.process(actionRequest, actionResponse, path);
      } catch (ServletException se) {
        throw new PortletException(se);
      }
    }

    if (copyRequestParameters) {
      PortalUtil.copyRequestParameters(actionRequest, actionResponse);
    }
  }
コード例 #4
0
  protected void checkPortletRequestProcessor(HttpServletRequest request) throws ServletException {

    ServletContext servletContext = getServletContext();

    PortletRequestProcessor portletReqProcessor =
        (PortletRequestProcessor) servletContext.getAttribute(WebKeys.PORTLET_STRUTS_PROCESSOR);

    if (portletReqProcessor == null) {
      ModuleConfig moduleConfig = getModuleConfig(request);

      portletReqProcessor = PortletRequestProcessor.getInstance(this, moduleConfig);

      servletContext.setAttribute(WebKeys.PORTLET_STRUTS_PROCESSOR, portletReqProcessor);
    }
  }