public void serveResource(
      ActionMapping actionMapping,
      ActionForm actionForm,
      PortletConfig portletConfig,
      ResourceRequest resourceRequest,
      ResourceResponse resourceResponse)
      throws Exception {

    String resourceID = resourceRequest.getResourceID();

    if (Validator.isNull(resourceID)) {
      return;
    }

    PortletContext portletContext = portletConfig.getPortletContext();

    PortletRequestDispatcher portletRequestDispatcher =
        portletContext.getRequestDispatcher(resourceID);

    if (portletRequestDispatcher == null) {
      return;
    }

    portletRequestDispatcher.forward(resourceRequest, resourceResponse);
  }
  /**
   * Serve the resource as specified in the given request to the given response, using the
   * PortletContext's request dispatcher.
   *
   * <p>This is roughly equivalent to Portlet 2.0 GenericPortlet.
   *
   * @param request the current resource request
   * @param response the current resource response
   * @param context the current Portlet's PortletContext
   * @throws PortletException propagated from Portlet API's forward method
   * @throws IOException propagated from Portlet API's forward method
   */
  public static void serveResource(
      ResourceRequest request, ResourceResponse response, PortletContext context)
      throws PortletException, IOException {

    String id = request.getResourceID();
    if (id != null) {
      if (!PortletUtils.isProtectedResource(id)) {
        PortletRequestDispatcher rd = context.getRequestDispatcher(id);
        if (rd != null) {
          rd.forward(request, response);
          return;
        }
      }
      response.setProperty(ResourceResponse.HTTP_STATUS_CODE, "404");
    }
  }
  @Override
  public void serveResource(ResourceRequest portletReq, ResourceResponse portletResp)
      throws PortletException, IOException {
    LOGGER.entering(LOG_CLASS, "main portlet serveResource entry");

    long tid = Thread.currentThread().getId();
    portletReq.setAttribute(THREADID_ATTR, tid);

    PrintWriter writer = portletResp.getWriter();

    // Now do the actual dispatch
    String target =
        SERVLET_PREFIX
            + "DispatcherTests_SPEC2_19_ForwardServletResource_servlet"
            + SERVLET_SUFFIX
            + "?"
            + QUERY_STRING;
    PortletRequestDispatcher rd = portletConfig.getPortletContext().getRequestDispatcher(target);
    rd.forward(portletReq, portletResp);
  }