private void setErrorAttributesAndForward(
     String forwardUrl,
     HttpServletRequest httpRequest,
     HttpServletResponse httpResponse,
     SaaSApplicationException e)
     throws ServletException, IOException {
   BesServletRequestReader.setErrorAttributes(httpRequest, e);
   forward(forwardUrl, httpRequest, httpResponse);
 }
  private HttpServletRequest handleServiceUrl(
      FilterChain chain,
      HttpServletRequest httpRequest,
      HttpServletResponse httpResponse,
      AuthorizationRequestData rdo)
      throws IOException, ServletException {

    VOMarketplace mpl;
    try {
      mpl = determineMarketplaceForSubscription(httpRequest, rdo);
    } catch (ObjectNotFoundException e) {

      logger.logError(
          Log4jLogger.SYSTEM_LOG,
          e,
          LogMessageIdentifier.ERROR_SUBSCRIPTION_NOT_FOUND,
          rdo.getSubscriptionKey());
      BesServletRequestReader.setErrorAttributes(httpRequest, e);

      handleSubscriptionNotFound(chain, httpRequest, httpResponse, rdo);
      return null;
    }

    // Bug 9588: Marketplace may have been deleted
    if (mpl != null) {
      httpRequest.setAttribute(
          Constants.REQ_ATTR_SERVICE_LOGIN_TYPE, Constants.REQ_ATTR_LOGIN_TYPE_MPL);

      httpRequest
          .getSession()
          .setAttribute(Constants.REQ_PARAM_MARKETPLACE_ID, mpl.getMarketplaceId());
    } else {
      httpRequest.setAttribute(
          Constants.REQ_ATTR_SERVICE_LOGIN_TYPE, Constants.REQ_ATTR_LOGIN_TYPE_NO_MPL);
    }

    String contextPath = rdo.getContextPath();
    if (!ADMStringUtils.isBlank(httpRequest.getQueryString())) {
      contextPath += "?" + httpRequest.getQueryString();
    }
    httpRequest.setAttribute(Constants.REQ_PARAM_SUB_KEY, rdo.getSubscriptionKey());
    httpRequest.setAttribute(Constants.REQ_PARAM_CONTEXT_PATH, contextPath);

    return processServiceUrl(
        httpRequest, httpResponse, chain, rdo.getSubscriptionKey(), contextPath, rdo);
  }