private ActionResult _doProcessAction(
      HttpServletRequest request, HttpServletResponse response, Portlet portlet) throws Exception {

    Layout layout = (Layout) request.getAttribute(WebKeys.LAYOUT);

    WindowState windowState =
        WindowStateFactory.getWindowState(ParamUtil.getString(request, "p_p_state"));

    if (layout.isTypeControlPanel()
        && ((windowState == null)
            || windowState.equals(WindowState.NORMAL)
            || Validator.isNull(windowState.toString()))) {

      windowState = WindowState.MAXIMIZED;
    }

    PortletMode portletMode =
        PortletModeFactory.getPortletMode(ParamUtil.getString(request, "p_p_mode"));

    PortletPreferencesIds portletPreferencesIds =
        PortletPreferencesFactoryUtil.getPortletPreferencesIds(request, portlet.getPortletId());

    PortletPreferences portletPreferences =
        PortletPreferencesLocalServiceUtil.getStrictPreferences(portletPreferencesIds);

    ServletContext servletContext = (ServletContext) request.getAttribute(WebKeys.CTX);

    InvokerPortlet invokerPortlet = PortletInstanceFactoryUtil.create(portlet, servletContext);

    PortletConfig portletConfig = PortletConfigFactoryUtil.create(portlet, servletContext);
    PortletContext portletContext = portletConfig.getPortletContext();

    String contentType = request.getHeader(HttpHeaders.CONTENT_TYPE);

    if (_log.isDebugEnabled()) {
      _log.debug("Content type " + contentType);
    }

    UploadServletRequest uploadServletRequest = null;

    try {
      if ((contentType != null) && contentType.startsWith(ContentTypes.MULTIPART_FORM_DATA)) {

        LiferayPortletConfig liferayPortletConfig =
            (LiferayPortletConfig) invokerPortlet.getPortletConfig();

        if (invokerPortlet.isStrutsPortlet()
            || liferayPortletConfig.isCopyRequestParameters()
            || !liferayPortletConfig.isWARFile()) {

          uploadServletRequest = PortalUtil.getUploadServletRequest(request);

          request = uploadServletRequest;
        }
      }

      ActionRequestImpl actionRequestImpl =
          ActionRequestFactory.create(
              request,
              portlet,
              invokerPortlet,
              portletContext,
              windowState,
              portletMode,
              portletPreferences,
              layout.getPlid());

      User user = PortalUtil.getUser(request);

      ActionResponseImpl actionResponseImpl =
          ActionResponseFactory.create(
              actionRequestImpl,
              response,
              portlet.getPortletId(),
              user,
              layout,
              windowState,
              portletMode);

      actionRequestImpl.defineObjects(portletConfig, actionResponseImpl);

      ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequestImpl);

      ServiceContextThreadLocal.pushServiceContext(serviceContext);

      invokerPortlet.processAction(actionRequestImpl, actionResponseImpl);

      actionResponseImpl.transferHeaders(response);

      RenderParametersPool.put(
          request,
          layout.getPlid(),
          portlet.getPortletId(),
          actionResponseImpl.getRenderParameterMap());

      List<Event> events = actionResponseImpl.getEvents();

      String redirectLocation = actionResponseImpl.getRedirectLocation();

      if (Validator.isNull(redirectLocation) && portlet.isActionURLRedirect()) {

        PortletURL portletURL =
            new PortletURLImpl(
                actionRequestImpl,
                actionRequestImpl.getPortletName(),
                layout.getPlid(),
                PortletRequest.RENDER_PHASE);

        Map<String, String[]> renderParameters = actionResponseImpl.getRenderParameterMap();

        for (Map.Entry<String, String[]> entry : renderParameters.entrySet()) {

          String key = entry.getKey();
          String[] value = entry.getValue();

          portletURL.setParameter(key, value);
        }

        redirectLocation = portletURL.toString();
      }

      return new ActionResult(events, redirectLocation);
    } finally {
      if (uploadServletRequest != null) {
        uploadServletRequest.cleanUp();
      }

      ServiceContextThreadLocal.popServiceContext();
    }
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    UploadServletRequest uploadRequest = null;

    try {
      String cmd = ParamUtil.getString(request, Constants.CMD);

      ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

      long groupId = ParamUtil.getLong(request, "groupId");
      String articleId = ParamUtil.getString(request, "articleId");
      double version =
          ParamUtil.getDouble(request, "version", JournalArticleConstants.DEFAULT_VERSION);

      String languageId = LanguageUtil.getLanguageId(request);

      String output = null;

      if (cmd.equals(Constants.PREVIEW)) {
        uploadRequest = PortalUtil.getUploadServletRequest(request);

        String title = ParamUtil.getString(uploadRequest, "title");
        String description = ParamUtil.getString(uploadRequest, "description");
        String type = ParamUtil.getString(uploadRequest, "type");
        String structureId = ParamUtil.getString(uploadRequest, "structureId");
        String templateId = ParamUtil.getString(uploadRequest, "templateId");

        Date now = new Date();

        Date createDate = now;
        Date modifiedDate = now;
        Date displayDate = now;

        User user = PortalUtil.getUser(uploadRequest);

        String xml = ParamUtil.getString(uploadRequest, "xml");

        Document doc = SAXReaderUtil.read(xml);

        Element root = doc.getRootElement();

        String previewArticleId = "PREVIEW_" + PwdGenerator.getPassword(PwdGenerator.KEY3, 10);

        format(groupId, articleId, version, previewArticleId, root, uploadRequest);

        Map<String, String> tokens = JournalUtil.getTokens(groupId, themeDisplay);

        tokens.put("article_resource_pk", "-1");

        JournalArticle article = new JournalArticleImpl();

        article.setGroupId(groupId);
        article.setCompanyId(user.getCompanyId());
        article.setUserId(user.getUserId());
        article.setUserName(user.getFullName());
        article.setCreateDate(createDate);
        article.setModifiedDate(modifiedDate);
        article.setArticleId(articleId);
        article.setVersion(version);
        article.setTitle(title);
        article.setDescription(description);
        article.setContent(xml);
        article.setType(type);
        article.setStructureId(structureId);
        article.setTemplateId(templateId);
        article.setDisplayDate(displayDate);

        output =
            JournalArticleLocalServiceUtil.getArticleContent(
                article, templateId, null, languageId, themeDisplay);
      } else {
        output =
            JournalArticleServiceUtil.getArticleContent(
                groupId, articleId, version, languageId, themeDisplay);
      }

      request.setAttribute(WebKeys.JOURNAL_ARTICLE_CONTENT, output);

      if (output.startsWith("<?xml ")) {
        return mapping.findForward("portlet.journal.raw_article_content");
      } else {
        return mapping.findForward("portlet.journal.view_article_content");
      }
    } catch (Exception e) {
      PortalUtil.sendError(e, request, response);

      return null;
    } finally {
      if (uploadRequest != null) {
        uploadRequest.cleanUp();
      }
    }
  }