Пример #1
0
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig config,
      RenderRequest req,
      RenderResponse res)
      throws Exception {
    if (getForward(req) != null && !getForward(req).equals("")) {
      return mapping.findForward(getForward(req)); // Use forward set in processAction if available
    } else {
      List<LinhVucThuTucHanhChinh> linhVucThuTucHanhChinhList =
          new ArrayList<LinhVucThuTucHanhChinh>();
      linhVucThuTucHanhChinhList = LinhVucThuTucHanhChinhLocalServiceUtil.findByActive(1);

      List<DonViThuTuc> capThanhPhoList = DonViThuTucLocalServiceUtil.findByCapDonVi_Active(1, 1);
      List<DonViThuTuc> capQuanHuyenList = DonViThuTucLocalServiceUtil.findByCapDonVi_Active(2, 1);
      List<DonViThuTuc> capPhuongXaList = DonViThuTucLocalServiceUtil.findByCapDonVi_Active(3, 1);

      req.setAttribute("linhVucThuTucHanhChinhList", linhVucThuTucHanhChinhList);
      req.setAttribute("capThanhPhoList", capThanhPhoList);
      req.setAttribute("capQuanHuyenList", capQuanHuyenList);
      req.setAttribute("capPhuongXaList", capPhuongXaList);
      return mapping.findForward("portlet.nss.thu_tuc_hanh_chinh_display.view");
    }
  }
  @Override
  public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
    PortletSession session = request.getPortletSession();
    MainSessionController mainSessionController =
        (MainSessionController)
            session.getAttribute(
                MainSessionController.MAIN_SESSION_CONTROLLER_ATT,
                PortletSession.APPLICATION_SCOPE);

    String spaceId =
        (String)
            session.getAttribute("Silverpeas_Portlet_SpaceId", PortletSession.APPLICATION_SCOPE);

    PortletPreferences pref = request.getPreferences();
    int nbPublis = 5;
    if (StringUtil.isInteger(pref.getValue("nbPublis", "5"))) {
      nbPublis = Integer.parseInt(pref.getValue("nbPublis", "5"));
    }
    int maxAge = 0;
    if (StringUtil.isInteger(pref.getValue("maxAge", "0"))) {
      maxAge = Integer.parseInt(pref.getValue("maxAge", "0"));
    }
    KmeliaTransversal kmeliaTransversal = new KmeliaTransversal(mainSessionController);
    List<PublicationDetail> publications =
        kmeliaTransversal.getUpdatedPublications(spaceId, maxAge, nbPublis);
    if (StringUtil.isDefined(spaceId)) {
      String rssUrl = getRSSUrl(mainSessionController, spaceId);
      request.setAttribute("rssUrl", rssUrl);
    }
    request.setAttribute("Publications", publications);
    include(request, response, "portlet.jsp");
  }
  // Read access token from DB and display error message if it's not available
  protected AccessToken loadAccessTokenOrRedirectToObtainIt(
      String username, OAuthProvider oauthProvider, RenderRequest request, RenderResponse response)
      throws IOException, PortletException {
    // Try requestContext first. Otherwise obtain OAuthProvider via API
    AccessToken accessToken = requestContext.getAccessToken(oauthProviderKey);
    if (accessToken == null) {
      accessToken = oauthProvider.loadAccessToken(username);
    }

    if (accessToken == null) {
      // Will be processed by method AbstractSocialPortlet.actionRedirectToOAuthFlow
      PortletURL actionURL = response.createActionURL();
      actionURL.setParameter(
          ActionRequest.ACTION_NAME, AbstractSocialPortlet.ACTION_OAUTH_REDIRECT);

      request.setAttribute(
          ATTRIBUTE_ERROR_MESSAGE,
          oauthProvider.getFriendlyName() + " access token not available for you.");
      request.setAttribute(ATTRIBUTE_OAUTH_PROVIDER, oauthProvider);
      PortletRequestDispatcher prd =
          filterConfig.getPortletContext().getRequestDispatcher("/jsp/error/token.jsp");
      prd.include(request, response);
    }

    return accessToken;
  }
Пример #4
0
  @Override
  public ActionForward render(
      ActionMapping actionMapping,
      ActionForm actionForm,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

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

    try {
      renderRequest.setAttribute(
          WebKeys.SOCIAL_ACTIVITY_SETTINGS_MAP, getActivitySettingsMap(themeDisplay));
    } catch (Exception e) {
      if (e instanceof PrincipalException) {
        SessionErrors.add(renderRequest, e.getClass());

        return actionMapping.findForward("portlet.social_activity.error");
      } else {
        throw e;
      }
    }

    return actionMapping.findForward("portlet.social_activity.view");
  }
Пример #5
0
  public static PortletURL getCurrent(RenderRequest req, RenderResponse res) {
    PortletURL portletURL = res.createRenderURL();

    Enumeration enu = req.getParameterNames();

    while (enu.hasMoreElements()) {
      String param = (String) enu.nextElement();
      String[] values = req.getParameterValues(param);

      boolean addParam = true;

      // Don't set paramter values that are over 32 kb. See LEP-1755.

      for (int i = 0; i < values.length; i++) {
        if (values[i].length() > _CURRENT_URL_PARAMETER_THRESHOLD) {
          addParam = false;

          break;
        }
      }

      if (addParam) {
        portletURL.setParameter(param, values);
      }
    }

    return portletURL;
  }
Пример #6
0
 public void doView(RenderRequest request, RenderResponse response)
     throws PortletException, IOException {
   String siteName = request.getPreferences().getValue("SRC", null);
   SSOSite site = null;
   if (siteName != null) {
     site = sso.getSiteByUrl(siteName);
   }
   if (site == null) {
     response.getWriter().print(NO_CREDENTIALS);
     return;
   } else {
     PasswordCredential pwc = SSOPortletUtil.getCredentialsForSite(sso, siteName, request);
     if (pwc != null) {
       request.setAttribute(SSO_REQUEST_ATTRIBUTE_USERNAME, pwc.getUserName());
       request.setAttribute(SSO_REQUEST_ATTRIBUTE_PASSWORD, pwc.getPassword());
     } else {
       response.getWriter().print(NO_CREDENTIALS);
       return;
     }
   }
   StatusMessage msg =
       (StatusMessage) PortletMessaging.consume(request, "SSOWebContent", "status");
   if (msg != null) {
     this.getContext(request).put("statusMsg", msg);
   }
   super.doView(request, response);
 }
Пример #7
0
  @Override
  public void render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws PortletException, IOException {

    try {
      int status = getStatus(renderRequest);

      renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_STATUS, status);

      KBArticle kbArticle = null;

      long resourcePrimKey = getResourcePrimKey(renderRequest);

      if (resourcePrimKey > 0) {
        kbArticle = KBArticleServiceUtil.getLatestKBArticle(resourcePrimKey, status);
      }

      renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_KB_ARTICLE, kbArticle);
    } catch (Exception e) {
      if (e instanceof NoSuchArticleException || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass().getName());

        PortletConfig portletConfig = getPortletConfig();

        SessionMessages.add(
            renderRequest,
            portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
      } else {
        throw new PortletException(e);
      }
    }

    super.render(renderRequest, renderResponse);
  }
  @Override
  public int doEndTag() throws JspException {
    // From portlet:defineObjects
    final RenderRequest renderRequest =
        (RenderRequest) this.pageContext.getAttribute("renderRequest");
    final RenderResponse renderResponse =
        (RenderResponse) this.pageContext.getAttribute("renderResponse");

    final PortletDelegationLocator portletDelegationLocator =
        (PortletDelegationLocator)
            renderRequest.getAttribute(PortletDelegationLocator.PORTLET_DELECATION_LOCATOR_ATTR);

    final String sessionKey = this.sessionKeyPrefix + this.fname;

    final PortletSession portletSession = renderRequest.getPortletSession();
    IPortletWindowId portletWindowId = (IPortletWindowId) portletSession.getAttribute(sessionKey);

    final PortletDelegationDispatcher portletDelegationDispatcher;
    final DelegateState delegateState;
    // No id in session, create a new dispatcher
    if (portletWindowId == null) {
      portletDelegationDispatcher =
          portletDelegationLocator.createRequestDispatcher(renderRequest, this.fname);
      portletWindowId = portletDelegationDispatcher.getPortletWindowId();
      portletSession.setAttribute(sessionKey, portletWindowId);

      final PortletMode portletMode = PortletUtils.getPortletMode(this.portletMode);
      final WindowState windowState = PortletUtils.getWindowState(this.windowState);

      delegateState = new DelegateState(portletMode, windowState);
    }
    // id in session, get the old dispatcher
    else {
      portletDelegationDispatcher =
          portletDelegationLocator.getRequestDispatcher(renderRequest, portletWindowId);
      delegateState = null;
    }

    final DelegationRequest delegationRequest = new DelegationRequest();
    delegationRequest.setDelegateState(delegateState);

    // Setup base for portlet URLs
    delegationRequest.setParentPortletMode(this.parentUrlMode);
    delegationRequest.setParentWindowState(this.parentUrlState);
    delegationRequest.setParentParameters(this.parentUrlParameters);

    final JspWriter out = this.pageContext.getOut();
    try {
      portletDelegationDispatcher.doRender(
          renderRequest,
          renderResponse,
          delegationRequest,
          new JspWriterPortletOutputHandler(out, renderResponse));
    } catch (IOException e) {
      throw new JspException(
          "Failed to execute delegate render on portlet '" + this.fname + "'", e);
    }

    return Tag.EVAL_PAGE;
  }
  public DDLDisplayContext(
      HttpServletRequest request,
      DDL ddl,
      DDLRecordSetLocalService ddlRecordSetLocalService,
      DDLWebConfiguration ddlWebConfiguration,
      DDMDisplayRegistry ddmDisplayRegistry,
      DDMTemplateLocalService ddmTemplateLocalService,
      StorageEngine storageEngine) {

    _ddl = ddl;
    _ddlRecordSetLocalService = ddlRecordSetLocalService;
    _ddlWebConfiguration = ddlWebConfiguration;
    _ddmDisplayRegistry = ddmDisplayRegistry;
    _ddmTemplateLocalService = ddmTemplateLocalService;
    _storageEngine = storageEngine;

    _ddlRequestHelper = new DDLRequestHelper(request);

    if (Validator.isNotNull(getPortletResource())) {
      return;
    }

    DDLRecordSet recordSet = getRecordSet();

    if ((recordSet == null) || !hasViewPermission()) {
      RenderRequest renderRequest = _ddlRequestHelper.getRenderRequest();

      renderRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE);
    }
  }
  /**
   * Sets the "javax.portlet.faces.viewIdHistory.<code>portletMode</code>" session attribute
   * according to the requirements in Section 5.4.3 of the Bridge Spec. There is no corresponding
   * getter method, because the value is meant to be retrieved by developers via an EL expression.
   *
   * @param viewId The current Faces viewId.
   */
  protected void setViewHistory(String viewId) {

    String attributeName =
        Bridge.VIEWID_HISTORY.concat(".").concat(renderRequest.getPortletMode().toString());
    PortletSession portletSession = renderRequest.getPortletSession();
    portletSession.setAttribute(attributeName, viewId);
  }
Пример #11
0
  @Override
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

    long actionId = ParamUtil.getLong(renderRequest, "actionId");

    MDRAction action = MDRActionServiceUtil.fetchAction(actionId);

    renderRequest.setAttribute(WebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION, action);

    String type = BeanPropertiesUtil.getString(action, "type");

    renderRequest.setAttribute(WebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION_TYPE, type);

    String editorJSP = getEditorJSP(type);

    renderRequest.setAttribute(WebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION_EDITOR_JSP, editorJSP);

    long ruleGroupInstanceId = BeanParamUtil.getLong(action, renderRequest, "ruleGroupInstanceId");

    MDRRuleGroupInstance ruleGroupInstance =
        MDRRuleGroupInstanceLocalServiceUtil.getMDRRuleGroupInstance(ruleGroupInstanceId);

    renderRequest.setAttribute(WebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_INSTANCE, ruleGroupInstance);

    return mapping.findForward("portlet.mobile_device_rules.edit_action");
  }
  @Override
  public String render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws PortletException {

    try {
      WikiNode node = ActionUtil.getNode(renderRequest);

      renderRequest.setAttribute(WikiWebKeys.WIKI_NODE, node);

      WikiPage page = ActionUtil.getPage(renderRequest);

      renderRequest.setAttribute(WikiWebKeys.WIKI_PAGE, page);
    } catch (Exception e) {
      if (e instanceof NoSuchNodeException
          || e instanceof NoSuchPageException
          || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass());

        return "/wiki/error.jsp";
      } else {
        throw new PortletException(e);
      }
    }

    return "/wiki/edit_page_attachment.jsp";
  }
Пример #13
0
  protected int getStatus(RenderRequest renderRequest) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

    if (!themeDisplay.isSignedIn()) {
      return WorkflowConstants.STATUS_APPROVED;
    }

    String value = renderRequest.getParameter("status");
    int status = GetterUtil.getInteger(value);

    if ((value != null) && (status == WorkflowConstants.STATUS_APPROVED)) {
      return WorkflowConstants.STATUS_APPROVED;
    }

    long resourcePrimKey = getResourcePrimKey(renderRequest);

    if (resourcePrimKey == 0) {
      return WorkflowConstants.STATUS_APPROVED;
    }

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (KBArticlePermission.contains(permissionChecker, resourcePrimKey, ActionKeys.UPDATE)) {

      return ParamUtil.getInteger(renderRequest, "status", WorkflowConstants.STATUS_ANY);
    }

    return WorkflowConstants.STATUS_APPROVED;
  }
 /**
  * Render.
  *
  * @param request the request
  * @param response the response
  * @param model the model
  * @return the string
  */
 @RenderMapping
 public String render(
     final RenderRequest request, final RenderResponse response, final Model model) {
   m_objLog.trace("render::start");
   String page = request.getParameter("jspPage");
   if (page == null) {
     page = "../shared/register";
     if (this.isLoggedInOrg(request)) {
       page = "registerLoggedIn";
     }
   }
   final String error = request.getParameter("error");
   if (error != null) {
     model.addAttribute("error", error);
     m_objLog.warn("Handing over error " + error);
     final String ePage = request.getParameter("errorPage");
     if (ePage != null) {
       page = ePage;
     }
   } /*
      * else { model.addAttribute("data", new BerliosProject()); }
      */
   m_objLog.trace("render::end(" + page + ")");
   return page;
 }
Пример #15
0
  protected long getResourcePrimKey(RenderRequest renderRequest) throws Exception {

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

    PortletPreferences preferences = renderRequest.getPreferences();

    long defaultValue = GetterUtil.getLong(preferences.getValue("resourcePrimKey", null));

    String mvcPath = ParamUtil.getString(renderRequest, "mvcPath");

    if (((defaultValue == 0) && mvcPath.equals(viewTemplate))
        || mvcPath.equals("/display/select_configuration_article.jsp")) {

      return 0;
    }

    long resourcePrimKey = ParamUtil.getLong(renderRequest, "resourcePrimKey", defaultValue);

    if ((resourcePrimKey == 0) || (resourcePrimKey != defaultValue)) {
      return resourcePrimKey;
    }

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (!KBArticlePermission.contains(permissionChecker, defaultValue, ActionKeys.VIEW)) {

      return 0;
    }

    return defaultValue;
  }
Пример #16
0
  @Override
  public void render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws PortletException, IOException {

    try {
      int status = getStatus(renderRequest);

      renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_STATUS, status);

      KBArticle kbArticle = null;

      long resourcePrimKey = ParamUtil.getLong(renderRequest, "resourcePrimKey");

      if (resourcePrimKey > 0) {
        kbArticle = KBArticleServiceUtil.getLatestKBArticle(resourcePrimKey, status);
      }

      renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_KB_ARTICLE, kbArticle);
    } catch (Exception e) {
      if (e instanceof NoSuchArticleException || e instanceof PrincipalException) {

        SessionErrors.add(renderRequest, e.getClass().getName());
      } else {
        throw new PortletException(e);
      }
    }

    super.render(renderRequest, renderResponse);
  }
  @Override
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig portletConfig,
      RenderRequest renderRequest,
      RenderResponse renderResponse)
      throws Exception {

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

    Map<String, List<SocialEquityActionMapping>> equityActionMappingsMap =
        new LinkedHashMap<String, List<SocialEquityActionMapping>>();

    String[] classNames = ResourceActionsUtil.getSocialEquityClassNames();

    Comparator<String> comparator = new ModelResourceComparator(themeDisplay.getLocale());

    Arrays.sort(classNames, comparator);

    for (String className : classNames) {
      List<SocialEquityActionMapping> mergedEquityActionMappings =
          getMergedEquityActionMappings(themeDisplay.getScopeGroupIdOrLiveGroupId(), className);

      equityActionMappingsMap.put(className, mergedEquityActionMappings);
    }

    renderRequest.setAttribute(WebKeys.SOCIAL_EQUITY_ACTION_MAPPINGS_MAP, equityActionMappingsMap);

    return mapping.findForward("portlet.social_equity_admin.view");
  }
  @Override
  public void execute() throws BridgeException {

    logger.debug(Logger.SEPARATOR);
    logger.debug(
        "execute(RenderRequest, RenderResponse) portletName=[{0}] portletMode=[{1}]",
        portletName, renderRequest.getPortletMode());

    Object renderPartAttribute = renderRequest.getAttribute(RenderRequest.RENDER_PART);

    if ((renderPartAttribute != null) && renderPartAttribute.equals(RenderRequest.RENDER_HEADERS)) {
      doFacesHeaders(renderRequest, renderResponse);
    } else {

      try {
        execute(null);
      } catch (BridgeException e) {
        throw e;
      } catch (Throwable t) {
        throw new BridgeException(t);
      } finally {
        cleanup(renderRequest);
      }

      logger.debug(Logger.SEPARATOR);
    }
  }
  protected void doHeaders(RenderRequest request, RenderResponse response) {
    super.doHeaders(request, response);
    PortalContext portalContext = request.getPortalContext();
    String portalInfo = portalContext.getPortalInfo();

    // -- adding DOM element to head is supported by JetSpeed 2.2
    if (portalInfo.contains(Constants.JETSPEED)) {
      // -- add CSS
      Element cssElement = response.createElement("link");
      // --encoding URLs is important
      cssElement.setAttribute(
          "href", response.encodeURL((request.getContextPath() + "/css/bookCatalog.css")));
      cssElement.setAttribute("rel", "stylesheet");
      cssElement.setAttribute("type", "text/css");
      response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, cssElement);

      // -- add JavaScript
      Element jsElement = response.createElement("script");

      // --encoding URLs to resources is important
      jsElement.setAttribute(
          "src", response.encodeURL((request.getContextPath() + "/js/bookCatalog.js")));
      jsElement.setAttribute("type", "text/javascript");
      response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, jsElement);
    }
  }
Пример #20
0
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig config,
      RenderRequest req,
      RenderResponse res)
      throws Exception {

    String cityId = ParamUtil.getString(req, "cityId");
    String districtId = ParamUtil.getString(req, "districtId");
    req.setAttribute("cityId", cityId);
    req.setAttribute("districtId", districtId);
    //		City city = null;
    //		District district = null;
    //		try {
    //			city = CityLocalServiceUtil.getCity(cityId);
    //			district = DistrictLocalServiceUtil.getDistrict(districtId);
    //			req.setAttribute("city", city);
    //			req.setAttribute("district", district);
    //		} catch (Exception e) {
    //		}

    getDistrictList(req);
    return mapping.findForward("portlet.sgs.citymanagement.wardmanagement");
  }
 @RenderMapping
 public String showHomePage(RenderRequest request, RenderResponse response) {
   String renderPage = TGPProcurementConstants.TGP_MARKET_INFO_POWER_TEXTAREAEDIT;
   tgpMessage.setErrorMessage(request.getParameter(TGPProcurementConstants.ERROR_MESSAGE));
   tgpMessage.setSuccessMessage(request.getParameter(TGPProcurementConstants.SUCCESS_MESSAGE));
   tgpMessage.setArguments(request.getParameter(TGPProcurementConstants.MESSAGE_ARGUMENTS));
   LOGGER.info("In showHomePage() method of TGPMarketInfoTextCommentAreaControllerForPower...");
   return renderPage;
 }
Пример #22
0
  public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {
    String name = renderRequest.getParameter("firstName");
    if (name != null && !name.equals("")) {
      renderRequest.setAttribute(
          "welcomeMessage", "hello " + name + ",do you want to register to our newsletter ?");
    }

    include(viewJSP, renderRequest, renderResponse);
  }
Пример #23
0
  /**
   * Sets the "javax.portlet.faces.viewIdHistory.<code>portletMode</code>" session attribute
   * according to the requirements in Section 5.4.3 of the Bridge Spec. There is no corresponding
   * getter method, because the value is meant to be retrieved by developers via an EL expression.
   *
   * @param viewId The current Faces viewId.
   */
  protected void setViewHistory(String viewId) {
    StringBuilder buf = new StringBuilder();
    buf.append(Bridge.VIEWID_HISTORY);
    buf.append(StringPool.PERIOD);
    buf.append(renderRequest.getPortletMode());

    String attributeName = buf.toString();
    PortletSession portletSession = renderRequest.getPortletSession();
    portletSession.setAttribute(attributeName, viewId);
  }
Пример #24
0
 /* (non-Javadoc)
  * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
  */
 @Override
 protected void doView(RenderRequest request, RenderResponse response)
     throws PortletException, IOException, UnavailableException {
   response.setContentType("text/html");
   String username = request.getParameter("usernameFromAction");
   request.setAttribute("usernameFromDoView", username);
   String jspPath = (username != null && !username.isEmpty()) ? "/hello.jsp" : "/view.jsp";
   PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(jspPath);
   prd.include(request, response);
 }
  public String renderDDMTemplate(
      PageContext pageContext,
      long ddmTemplateId,
      List<?> entries,
      Map<String, Object> contextObjects)
      throws Exception {

    contextObjects.put(PortletDisplayTemplateConstants.DDM_TEMPLATE_ID, ddmTemplateId);
    contextObjects.put(PortletDisplayTemplateConstants.ENTRIES, entries);

    if (entries.size() == 1) {
      contextObjects.put(PortletDisplayTemplateConstants.ENTRY, entries.get(0));
    }

    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    contextObjects.put(PortletDisplayTemplateConstants.LOCALE, request.getLocale());

    contextObjects.put(PortletDisplayTemplateConstants.REQUEST, request);

    RenderRequest renderRequest =
        (RenderRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);

    contextObjects.put(PortletDisplayTemplateConstants.RENDER_REQUEST, renderRequest);

    RenderResponse renderResponse =
        (RenderResponse) request.getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE);

    contextObjects.put(PortletDisplayTemplateConstants.RENDER_RESPONSE, renderResponse);

    PortletURL currentURL = PortletURLUtil.getCurrent(renderRequest, renderResponse);

    contextObjects.put(PortletDisplayTemplateConstants.CURRENT_URL, currentURL.toString());

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

    contextObjects.put(PortletDisplayTemplateConstants.THEME_DISPLAY, themeDisplay);

    // Taglibs

    DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.getTemplate(ddmTemplateId);

    String language = ddmTemplate.getLanguage();

    if (language.equals(TemplateConstants.LANG_TYPE_FTL)) {
      _addTaglibSupportFTL(contextObjects, pageContext);
    } else if (language.equals(TemplateConstants.LANG_TYPE_VM)) {
      _addTaglibSupportVM(contextObjects, pageContext);
    }

    contextObjects.putAll(_getPortletPreferences(renderRequest));

    return _transformer.transform(themeDisplay, contextObjects, ddmTemplate.getScript(), language);
  }
  @Override
  protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    renderRequest.setAttribute(ApplicationListWebKeys.GROUP_PROVIDER, _groupProvider);
    renderRequest.setAttribute(ApplicationListWebKeys.PANEL_APP_REGISTRY, _panelAppRegistry);
    renderRequest.setAttribute(
        ApplicationListWebKeys.PANEL_CATEGORY_REGISTRY, _panelCategoryRegistry);

    super.doDispatch(renderRequest, renderResponse);
  }
Пример #27
0
 /**
  * Override doDispatch method for handling custom portlet modes.
  *
  * @see javax.portlet.GenericPortlet#doDispatch(javax.portlet.RenderRequest,
  *     javax.portlet.RenderResponse)
  */
 protected void doDispatch(RenderRequest request, RenderResponse response)
     throws PortletException, IOException {
   if (!WindowState.MINIMIZED.equals(request.getWindowState())) {
     PortletMode mode = request.getPortletMode();
     if (CUSTOM_CONFIG_MODE.equals(mode)) {
       doCustomConfigure(request, response);
       return;
     }
   }
   super.doDispatch(request, response);
 }
Пример #28
0
 @Override
 protected ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response)
     throws Exception {
   Map<String, Object> bean = new HashMap<String, Object>();
   String currentURL = "";
   if (request.getParameter(News_Const.CURRENT_URL) != null) {
     currentURL = request.getParameter(News_Const.CURRENT_URL);
   }
   bean.put("currentURL", currentURL);
   return new ModelAndView(this.getViewName(), "bean", bean);
 }
  @Override
  public void render(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {

    PortletPreferences preferences = request.getPreferences();
    String defaultArticle = preferences.getValue(DEFAULT_ARTICLE, LR_EMPTY_VALUE);
    String[] addedArticleIds =
        preferences.getValue(ARTICLE_ID, LR_EMPTY_VALUE).split(ARTICLE_SELECTION_DELIMITER);
    request.setAttribute(DEFAULT_ARTICLE, defaultArticle);
    request.setAttribute(ADDED_ARTICLE_IDS, addedArticleIds);
    super.render(request, response);
  }
Пример #30
0
  @Override
  public void doEditGuest(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    if (renderRequest.getPreferences() == null) {
      super.doEdit(renderRequest, renderResponse);
    } else {
      renderRequest.setAttribute(WebKeys.PORTLET_STRUTS_ACTION, editGuestAction);

      include(renderRequest, renderResponse);
    }
  }