Package net.tinyportal.bean

Examples of net.tinyportal.bean.PortletHolder


   *
   */
  private static final long serialVersionUID = -8600379354900750028L;

  protected PortletURL getPortletURL() {
    PortletHolder portletBean = (PortletHolder) pageContext.getAttribute(Constant.session_portlet_bean);
    if (portletBean == null)
      portletBean = (PortletHolder)pageContext.getRequest().getAttribute(Constant.session_portlet_bean);

    PortletURL portletURL = portletBean.getRenderResponse().createRenderURL();
    return portletURL;
  }
View Full Code Here


      throw new JspException ("Error", e);
    }
  }
 
  protected PortletURL getPortletURL() {
    PortletHolder portletBean = (PortletHolder) pageContext.getAttribute(Constant.session_portlet_bean);
    if (portletBean == null)
      portletBean = (PortletHolder)pageContext.getRequest().getAttribute(Constant.session_portlet_bean);

    PortletURL portletURL = portletBean.getRenderResponse().createActionURL();
    return portletURL;
  }
View Full Code Here

        @SuppressWarnings("rawtypes")
        Class c = loader.loadClass(portletClass);
        GenericPortlet portlet = (GenericPortlet)c.newInstance();
        portlet.init(TPconfig);

        PortletHolder portletHolder = new PortletHolder(portlet,portletXml);
        portletPool.put(portletHolder.getPortletName(), portletHolder);
      } catch (PortletException pe) {
        //Exception levée lors de l'initialisation du portlet, on passe
        // la suite du traitement du portlet
//        return;
      } catch (RuntimeException re) {
View Full Code Here

  /*
   * On recupere soit le portlet de la session, soit un nouveau portlet qui est alors mis en session
   */
  public static PortletHolder getPortlet(HttpServletRequest request, String portletName) {
    HttpSession session = request.getSession(true);
    PortletHolder bean = (PortletHolder)session.getAttribute(portletName);
    if (bean == null) {
      PortletHolder legacy = portletPool.get(portletName);
      session.setAttribute(portletName, bean = legacy.clone());
    }
   
    return bean;
  }
View Full Code Here

        if (!Portal.isActivePortlet(portletName)) continue;

        /*
         * On récupère le bean associé au portlet
         */
        PortletHolder portletHolder = Portal.getPortlet(request, portletName);
        GenericPortlet portlet = portletHolder.getPortlet();

        /*
         * DOGET
         */
        String portletId = TpPortletURL.getPortletId(portletHolder);

        TpPortletContext TpPortletContext = (TpPortletContext) portlet.getPortletContext();
        TpRenderRequest TPrequest = new TpRenderRequest(portletHolder, request, TpPortletContext);
        TpRenderResponse TPresponse = new TpRenderResponse(response, portletId);

        /*
         * On positionne le bean portlet dans la requête pour pouvoir y accéder depuis les taglibs
         */
        TPrequest.setAttribute(Constant.session_portlet_bean,portletHolder);

        portletHolder.setRenderRequest(TPrequest);
        portletHolder.setRenderResponse(TPresponse);
        portletHolder.setPortletConfig(portlet.getPortletConfig());

        try {
          /*
           * On effectue les taches d'ACTION
           */
          StringBuffer sb = new StringBuffer(portletId).append("_").append("action");
          String action = request.getParameter(sb.toString());
          if ("action".equalsIgnoreCase(action)) {
            Portal.doAction(request, response, portletHolder, portlet);
          } else if ("render".equalsIgnoreCase(action)) {
            Portal.doRender(request, response, portletHolder, portlet);
          } else {
            Portal.setWindowState(request, portletHolder);
            Portal.setPortletMode(request, portletHolder);
          }
          /*
           * de RENDU
           */
          Portal.doRender(request, response, portletHolder, portlet);

          /*
           *
           */
          try {
            Portal.doRefresh(request, response, portletHolder, portlet);
          } catch (PortletException e) {
            log(e.getMessage());
            portletHolder.setTitle("Erreur sur le portlet");
            portletHolder.setContent("/!\\ Erreur !!" + e.getMessage());
          }
          /*
           * Enfin, on place le portletHolder dans la map des portlets
           * disponible
           */
          portletsMap.put(portletName, portletHolder);
        } catch (UnavailableException ue) {
          portlet.destroy();
          Portal.addDisabledPortlet(portletName);

        } catch (PortletException e) {
          log(e.getMessage());
          portletHolder.setTitle("Erreur sur le portlet");
          portletHolder.setContent("/!\\ Erreur !!" + e.getMessage());
        }
      }

      /*
       * On fait le rendu du portail
View Full Code Here

      if (!Portal.isActivePortlet(portletName)) continue;

      /*
       * On récupère le bean associé au portlet
       */
      PortletHolder bean = Portal.getPortlet(request, portletName);
      GenericPortlet portlet = bean.getPortlet();
      /*
       * DOGET
       */


      String portletId = TpPortletURL.getPortletId(bean);

      TpPortletContext TpPortletContext = (TpPortletContext) portlet.getPortletContext();
      TpRenderRequest TPrequest = new TpRenderRequest(bean, request, TpPortletContext);
      TpRenderResponse TPresponse = new TpRenderResponse(response, portletId);

      /*
       * On positionne le bean portlet dans la requête pour pouvoir y accéder depuis les taglibs
       */
      TPrequest.setAttribute(Constant.session_portlet_bean,bean);

      bean.setRenderRequest(TPrequest);
      bean.setRenderResponse(TPresponse);
      bean.setPortletConfig(portlet.getPortletConfig());

      try

        StringBuffer sb = new StringBuffer(portletId).append("_").append("action");
        String action = request.getParameter(sb.toString());
        if ("action".equalsIgnoreCase(action)) {

          Portal.doAction(request, response, bean, portlet);
        } else if ("render".equalsIgnoreCase(action)) {
          Portal.doRender(request, response, bean, portlet);
        } else {
          sb = new StringBuffer(portletId).append("_").append("mode");
          String mode = request.getParameter(sb.toString());
          if (null != mode) {
            bean.setPortletMode(new PortletMode(mode));
          }
          sb = new StringBuffer(portletId).append("_").append("state");
          String state = request.getParameter(sb.toString());
          if (null != state) {
            bean.setWindowState(new WindowState(state));
          }
        }
        Portal.doRender(request, response, bean, portlet);
        Portal.doRefresh(request, response, bean, portlet);
        portletsMap.put(bean.getPortletName(), bean);
      } catch (UnavailableException ue) {
        portlet.destroy();
        Portal.addDisabledPortlet(portletName);

      } catch (Exception e) {
        e.printStackTrace();
        bean.setTitle("Erreur sur le portlet");
        bean.setContent("/!\\ Erreur !!" + e.getMessage());
        portletsMap.put(bean.getPortletName(), bean);
      }
      //            portletsBean.add(portletBean);
    }
    /*
     * On fait le rendu du portail
View Full Code Here

            if (portletName.startsWith(porltetMapsName+ "//@")) {
              PortletLoader pLoader = new PortletLoader((ServletContext)pageContext.getAttribute("javax.servlet.jsp.jspApplication"));
              PortletContext portletContext = (TpPortletContext)portletsMap.get(porltetMapsName).getPortletConfig().getPortletContext();
              Map<String, PortletHolder> result = pLoader.load(new File(portletContext.getRealPath("")), porltetMapsName);
             
              PortletHolder portletHolder = result.get(porltetMapsName);
             
              Portal.addPortlet(portletName, portletHolder);
              portletsMap.put(portletName, portletHolder);
              find = true;
              break;
View Full Code Here

TOP

Related Classes of net.tinyportal.bean.PortletHolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.