コード例 #1
0
 /**
  * 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;
 }
 @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;
 }
コード例 #3
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);
 }
コード例 #4
0
  @Override
  protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    try {
      String mvcPath = renderRequest.getParameter("mvcPath");

      if (mvcPath.equals("/edit_permissions.jsp")) {
        checkEditPermissionsJSP(renderRequest);

        super.doDispatch(renderRequest, renderResponse);

        return;
      }

      Portlet portlet = ActionUtil.getPortlet(renderRequest);

      if (mvcPath.endsWith("edit_configuration.jsp")) {
        ThemeDisplay themeDisplay =
            (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

        String settingsScope = renderRequest.getParameter("settingsScope");

        PortletPreferences portletPreferences =
            getPortletPreferences(themeDisplay, portlet.getPortletId(), settingsScope);

        renderRequest = ActionUtil.getWrappedRenderRequest(renderRequest, portletPreferences);

        renderEditConfiguration(renderRequest, portlet);
      } else {
        PortletPreferences portletPreferences =
            ActionUtil.getLayoutPortletSetup(renderRequest, portlet);

        renderRequest = ActionUtil.getWrappedRenderRequest(renderRequest, portletPreferences);

        if (mvcPath.endsWith("edit_public_render_parameters.jsp")) {
          renderEditPublicParameters(renderRequest, portlet);
        }
      }

      renderResponse.setTitle(ActionUtil.getTitle(portlet, renderRequest));

      super.doDispatch(renderRequest, renderResponse);
    } catch (Exception e) {
      _log.error(e.getMessage());

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

      include("/error.jsp", renderRequest, renderResponse);
    }
  }
コード例 #5
0
  /** @see de.ingrid.portal.portlets.admin.ContentPortlet#doViewNew(javax.portlet.RenderRequest) */
  protected boolean doViewNew(RenderRequest request) {
    try {
      AdminCMSForm f =
          (AdminCMSForm) Utils.getActionForm(request, AdminCMSForm.SESSION_KEY, AdminCMSForm.class);

      Object[] newEntity = {dbEntityClass.newInstance()};

      Context context = getContext(request);
      context.put(CONTEXT_MODE, CONTEXTV_MODE_NEW);
      context.put(CONTEXT_UTILS_STRING, new UtilsString());
      context.put(CONTEXT_ENTITIES, newEntity);

      String cmd = request.getParameter("cmd");
      if (cmd == null) {
        f.clear();
        f.clearMessages();
      }

      context.put("actionForm", f);

      setDefaultViewPage(viewNew);
      return true;
    } catch (Exception ex) {
      if (log.isErrorEnabled()) {
        log.error("Problems adding new entity:", ex);
      }
    }
    return false;
  }
コード例 #6
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;
  }
コード例 #7
0
  @Override
  public void render(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    try {
      HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(renderRequest);

      httpServletRequest = PortalUtil.getOriginalServletRequest(httpServletRequest);

      String oAuthVerifier = httpServletRequest.getParameter(OAuthConstants.VERIFIER);

      if (oAuthVerifier != null) {
        updateAccessToken(renderRequest, oAuthVerifier);
      }

      String remoteMVCPath = renderRequest.getParameter("remoteMVCPath");

      if (remoteMVCPath != null) {
        remoteRender(renderRequest, renderResponse);

        return;
      }
    } catch (IOException ioe) {
      throw ioe;
    } catch (Exception e) {
      throw new PortletException(e);
    }

    super.render(renderRequest, renderResponse);
  }
コード例 #8
0
ファイル: ParamUtils.java プロジェクト: jackrain/framework
 public static boolean getBooleanParameter(RenderRequest request, String paramName) {
   String temp = request.getParameter(paramName);
   if (temp != null && temp.trim().equalsIgnoreCase("true")) {
     return true;
   } else {
     return false;
   }
 }
コード例 #9
0
 protected void doEdit(RenderRequest request, RenderResponse response)
     throws PortletException, java.io.IOException {
   if (request.getParameter("type") != null && request.getParameter("type").equals("create")) {
     String page = request.getParameter("pageId");
     if (page == null) page = "1";
     int pageId = Integer.parseInt(page);
     request.setAttribute("pageId", pageId);
     if (request.getWindowState().equals(WindowState.MAXIMIZED))
       this.getPortletContext()
           .getRequestDispatcher(_PORTLET_JSP_PATH + "/email/emailPortletMaxEdit.jsp")
           .include(request, response);
     else
       this.getPortletContext()
           .getRequestDispatcher(_PORTLET_JSP_PATH + "/email/emailPortletEdit.jsp")
           .include(request, response);
   } else {
     PortletPreferences portletPreferences = request.getPreferences();
     String fullName = portletPreferences.getValue("fullName", null);
     String incomingType = portletPreferences.getValue("incomingType", null);
     String incoming = portletPreferences.getValue("incoming", null);
     String incomingPort = portletPreferences.getValue("incomingPort", null);
     String incomingSSL = portletPreferences.getValue("incomingSSL", null);
     String outgoing = portletPreferences.getValue("outgoing", null);
     String outgoingPort = portletPreferences.getValue("outgoingPort", null);
     String outgoingSSL = portletPreferences.getValue("outgoingSSL", null);
     String email = portletPreferences.getValue("email", null);
     String password = portletPreferences.getValue("password", null);
     String number = portletPreferences.getValue("number", "10");
     request.setAttribute("fullName", fullName);
     request.setAttribute("incomingType", incomingType);
     request.setAttribute("incoming", incoming);
     request.setAttribute("incomingPort", incomingPort);
     request.setAttribute("incomingSSL", incomingSSL);
     request.setAttribute("outgoing", outgoing);
     request.setAttribute("outgoingPort", outgoingPort);
     request.setAttribute("outgoingSSL", outgoingSSL);
     request.setAttribute("email", email);
     request.setAttribute("password", password);
     request.setAttribute("number", number);
     this.getPortletContext()
         .getRequestDispatcher(_PORTLET_JSP_PATH + "/email/emailPortletConfig.jsp")
         .include(request, response);
   }
 }
コード例 #10
0
ファイル: WelcomePortlet.java プロジェクト: fbihack/portlets
  public void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    String jspPage = renderRequest.getParameter("jspPage");
    if (jspPage != null) {
      include(jspPage, renderRequest, renderResponse);
    } else {
      super.doDispatch(renderRequest, renderResponse);
    }
  }
コード例 #11
0
ファイル: WelcomePortlet.java プロジェクト: fbihack/portlets
  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);
  }
コード例 #12
0
ファイル: SamplePortlet.java プロジェクト: qa/system-int
 /* (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);
 }
コード例 #13
0
 public void doView(RenderRequest request, RenderResponse response)
     throws PortletException, IOException {
   String sYourName = (String) request.getParameter("yourname");
   if (sYourName != null) {
     PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/hello.jsp");
     prd.include(request, response);
   } else {
     PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/welcome.jsp");
     prd.include(request, response);
   }
 }
コード例 #14
0
  @Override
  public void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    String mvcPath = renderRequest.getParameter("mvcPath");

    if (mvcPath != null) {
      include(mvcPath, renderRequest, renderResponse);
    } else {
      super.doDispatch(renderRequest, renderResponse);
    }
  }
コード例 #15
0
  @RenderMapping(params = "action=addupdatefly")
  public ModelAndView haddUpdate(
      RenderRequest request, RenderResponse response, ModelMap modelMap) {

    System.out.println("CIAOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");

    String parameter = request.getParameter("hiddencodiceVolo");
    System.out.println(parameter);
    VoloDTO v = new VoloDTO();
    v.setCodiceVolo(parameter);
    modelMap.put("volo", v);

    return new ModelAndView("form", modelMap);
  }
コード例 #16
0
  public String doView(RenderRequest request, RenderResponse response) throws Exception {
    // The JSP to show upon success
    String defaultView = VIEW_PAGE;

    String ctx = request.getContextPath();

    // Determine the project container to use
    Project project = findProject(request);

    // Check the user's permissions
    User user = getUser(request);
    if (!ProjectUtils.hasAccess(project.getId(), user, "project-discussion-topics-view")) {
      throw new PortletException("Unauthorized to view in this project");
    }

    // Retrieve parameters
    int forumId = PortalUtils.getPageViewAsInt(request);
    String resetList = request.getParameter("resetList");

    // Build a list of records
    Connection db = useConnection(request);

    // Paging will be used for remembering several list view settings
    if ("true".equals(resetList)) {
      // deletePagedListInfo(request, "projectIssuesInfo");
    }
    PagedListInfo pagedListInfo = getPagedListInfo(request, PAGED_LIST_INFO);
    pagedListInfo.setLink(ctx + "/show/" + project.getUniqueId() + "/forum/" + forumId);
    if (pagedListInfo.getInitializationLevel() == PagedListInfo.LEVEL_INITIALIZED) {
      pagedListInfo.setColumnToSortBy("i.last_reply_date");
      pagedListInfo.setSortOrder("desc");
    }

    // Load the category info
    Forum forum = new Forum(db, forumId, project.getId());
    request.setAttribute(FORUM, forum);
    PortalUtils.setGeneratedData(request, FORUM, forum);
    // Load the records
    TopicList topicList = new TopicList();
    topicList.setProjectId(project.getId());
    topicList.setCategoryId(forum.getId());
    topicList.setPagedListInfo(pagedListInfo);
    topicList.buildList(db);
    request.setAttribute(TOPIC_LIST, topicList);

    // JSP view
    return defaultView;
  }
コード例 #17
0
  protected int getStatus(RenderRequest renderRequest) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

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

    String statusString = renderRequest.getParameter("status");

    int status = GetterUtil.getInteger(statusString);

    if ((statusString != null) && (status == WorkflowConstants.STATUS_APPROVED)) {

      return WorkflowConstants.STATUS_APPROVED;
    }

    Tuple resourceTuple = getResourceTuple(renderRequest);

    long resourcePrimKey = (Long) resourceTuple.getObject(1);

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

    long resourceClassNameId = (Long) resourceTuple.getObject(0);

    long kbArticleClassNameId = PortalUtil.getClassNameId(KBArticleConstants.getClassName());

    if (resourceClassNameId == kbArticleClassNameId) {
      KBArticle kbArticle =
          KBArticleServiceUtil.fetchLatestKBArticle(resourcePrimKey, WorkflowConstants.STATUS_ANY);

      if (kbArticle == null) {
        return WorkflowConstants.STATUS_APPROVED;
      }

      if (KBArticlePermission.contains(
          themeDisplay.getPermissionChecker(), resourcePrimKey, ActionKeys.UPDATE)) {

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

    return WorkflowConstants.STATUS_APPROVED;
  }
コード例 #18
0
  public void doView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
      throws PortletException, IOException {
    Context context = getContext(request);
    IngridResourceBundle messages =
        new IngridResourceBundle(
            getPortletConfig().getResourceBundle(request.getLocale()), request.getLocale());
    context.put("MESSAGES", messages);

    // enable/disable providers drop down
    String selectedDS =
        SearchState.getSearchStateObjectAsString(request, Settings.PARAM_DATASOURCE);
    if (PortalConfig.getInstance().getBoolean(PortalConfig.PORTAL_SEARCH_DISPLAY_PROVIDERS)
        || selectedDS.equals(Settings.PARAMV_DATASOURCE_ENVINFO)
            && PortalConfig.getInstance()
                .getBoolean(PortalConfig.PORTAL_SEARCH_DISPLAY_PROVIDERS_ENVINFO)) {
      String partner =
          PortalConfig.getInstance().getString(PortalConfig.PORTAL_SEARCH_RESTRICT_PARTNER);
      List providers;
      if (partner == null || partner.length() == 0) {
        providers = UtilsDB.getProviders();
      } else {
        providers = UtilsDB.getProvidersFromPartnerKey(partner);
      }
      context.put("displayProviders", Boolean.TRUE);
      context.put("providers", providers);
      context.put("UtilsString", new UtilsString());

      // get selected provider
      IngridSessionPreferences sessionPrefs =
          Utils.getSessionPreferences(
              request, IngridSessionPreferences.SESSION_KEY, IngridSessionPreferences.class);
      String provider = request.getParameter(Settings.PARAM_PROVIDER);
      if (provider != null) {
        sessionPrefs.put(IngridSessionPreferences.RESTRICTING_PROVIDER, provider);
      }
      context.put(
          "selectedProviderIdent", sessionPrefs.get(IngridSessionPreferences.RESTRICTING_PROVIDER));
    }

    super.doView(request, response);
  }
コード例 #19
0
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig config,
      RenderRequest req,
      RenderResponse res)
      throws Exception {

    String orderBy = req.getParameter("orderBy");
    User user = _getUser(req);
    orderBy = (UtilMethods.isSet(orderBy) ? orderBy : "name");
    _loadStructures(
        req,
        user,
        WebKeys.STRUCTURES_VIEW_COUNT,
        WebKeys.Structure.STRUCTURES,
        WebKeys.STRUCTURE_QUERY);
    if (req.getWindowState().equals(WindowState.NORMAL)) {
      return mapping.findForward("portlet.ext.formhandler.view");
    } else {
      return mapping.findForward("portlet.ext.formhandler.view_form");
    }
  }
コード例 #20
0
ファイル: WhoisAction.java プロジェクト: nykma/ykt4sungard
  public ActionForward render(
      ActionMapping mapping,
      ActionForm form,
      PortletConfig config,
      RenderRequest req,
      RenderResponse res)
      throws Exception {

    String cmd = req.getParameter(Constants.CMD);

    if (cmd != null) {
      try {
        String domain = ParamUtil.getString(req, "domain");

        Whois whois = NetworkUtil.getWhois(domain);

        req.setAttribute(WebKeys.NETWORK_WHOIS, whois);
      } catch (Exception e) {
        SessionErrors.add(req, WhoisAction.class.getName());
      }
    }

    return mapping.findForward("portlet.network.whois");
  }
コード例 #21
0
  protected void _loadStructures(
      RenderRequest req, User user, String countWebKey, String viewWebKey, String queryWebKey)
      throws Exception {

    com.liferay.portlet.RenderRequestImpl reqImpl = (com.liferay.portlet.RenderRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
    // gets the session object for the messages
    HttpSession session = httpReq.getSession();

    Integer structureType =
        (Integer) session.getAttribute(com.dotmarketing.util.WebKeys.Structure.STRUCTURE_EDIT_TYPE);
    if (req.getParameter("structureType") != null)
      structureType = Integer.parseInt(req.getParameter("structureType"));
    if (structureType != null)
      session.setAttribute(
          com.dotmarketing.util.WebKeys.Structure.STRUCTURE_EDIT_TYPE, structureType);

    String query = req.getParameter("query");
    String resetQuery = req.getParameter("resetQuery");

    List<Structure> structures = new java.util.ArrayList<Structure>();

    try {
      String orderby = req.getParameter("orderBy");
      if (!UtilMethods.isSet(orderby)) {
        orderby = "upper(name)";
      }
      String direction = req.getParameter("direction");
      if (!UtilMethods.isSet(direction)) {
        direction = "asc";
      }

      int pageNumber = 1;

      if (UtilMethods.isSet(req.getParameter("pageNumber"))) {
        pageNumber = Integer.parseInt(req.getParameter("pageNumber"));
      }

      int limit = com.dotmarketing.util.Config.getIntProperty("PER_PAGE");

      int offset = (pageNumber - 1) * limit;

      if ((query == null) && (resetQuery == null)) {
        query = (String) session.getAttribute(queryWebKey);
      }
      session.setAttribute(queryWebKey, query);

      int count = 0;
      String queryCondition = "";

      if (((query != null) && (query.length() != 0)) || (structureType != null)) {

        if (query == null) query = "";
        query = query.trim();
        if (UtilMethods.isSet(query)) {
          queryCondition +=
              "(lower(name) "
                  + "like '%"
                  + query.toLowerCase().replace("\'", "\\\'")
                  + "%' or inode='"
                  + query
                  + "')";
        }

      } else {
        Logger.debug(this, "Getting all Forms Structures");
      }

      if (UtilMethods.isSet(queryCondition)) {
        queryCondition += " and structuretype=" + Structure.STRUCTURE_TYPE_FORM;
      } else {
        queryCondition += " structuretype=" + Structure.STRUCTURE_TYPE_FORM;
      }

      structures =
          StructureFactory.getStructuresByUser(
              user, queryCondition, orderby, limit, offset, direction);
      count = (int) ((PaginatedArrayList<Structure>) structures).getTotalResults();
      req.setAttribute(countWebKey, new Integer(count));
      req.setAttribute(viewWebKey, structures);
    } catch (Exception e) {
      req.setAttribute(viewWebKey, structures);
      Logger.error(this, "Exception e =" + e.getMessage(), e);
      throw new Exception(e.getMessage());
    }
  }
コード例 #22
0
  protected void doView(RenderRequest request, RenderResponse response)
      throws PortletException, java.io.IOException {
    String page = request.getParameter("pageId");
    if (page == null || page.trim().length() < 1) page = "1";
    int pageId = Integer.parseInt(page);
    if (request.getPortletSession().getAttribute("mails", PortletSession.PORTLET_SCOPE) == null
        || request.getParameter("refresh") != null
        || request.getParameter("newPage") != null) {
      PortletPreferences portletPreferences = request.getPreferences();
      UserProfile userProfile =
          this.getUserService(request).getUserProfileById(this.getUser(request).getId());
      String name = null;
      if (userProfile != null) name = userProfile.getName();
      if ((name == null || name.length() <= 0) && this.getUser(request) != null)
        name = this.getUser(request).getDisplayName();
      String fullName = portletPreferences.getValue("fullName", name);
      String incomingType = portletPreferences.getValue("incomingType", null);
      String incoming = portletPreferences.getValue("incoming", null);
      String incomingPort = portletPreferences.getValue("incomingPort", null);
      String incomingSSL = portletPreferences.getValue("incomingSSL", null);
      String outgoing = portletPreferences.getValue("outgoing", null);
      String outgoingPort = portletPreferences.getValue("outgoingPort", null);
      String outgoingSSL = portletPreferences.getValue("outgoingSSL", null);
      String email = portletPreferences.getValue("email", null);
      String password = portletPreferences.getValue("password", null);
      String number = portletPreferences.getValue("number", "10");
      if (incoming == null || outgoing == null || email == null || password == null) {
        request.setAttribute("incomingPort", "110");
        request.setAttribute("outgoingPort", "25");
        request.setAttribute("number", number);
        this.getPortletContext()
            .getRequestDispatcher(_PORTLET_JSP_PATH + "/email/emailPortletConfig.jsp")
            .include(request, response);
      } else {
        int row = Integer.parseInt(number);
        if (request.getParameter("refresh") != null) pageId = 1;
        List<MailBean> mails = null;
        EmailClient client =
            new EmailClient(
                email,
                password,
                incomingType,
                incoming,
                incomingPort,
                incomingSSL,
                outgoing,
                outgoingPort,
                outgoingPort);
        try {
          mails = client.getMessage(EmailClient.SHOW_MESSAGES, pageId, row);
        } catch (Exception e) {
          request.setAttribute("error", e.getMessage());
        }
        int count = 0;
        int unread = 0;
        if (mails != null && mails.size() > 0) {
          count = mails.get(0).getTotal();
          unread = mails.get(0).getUnreadCount();
        }
        int pages = count / row;
        if (count % row != 0) pages++;

        request.getPortletSession().setAttribute("mails", mails, PortletSession.PORTLET_SCOPE);
        request.getPortletSession().setAttribute("totalCount", count, PortletSession.PORTLET_SCOPE);
        request
            .getPortletSession()
            .setAttribute("unreadCount", unread, PortletSession.PORTLET_SCOPE);
        request.getPortletSession().setAttribute("pages", pages, PortletSession.PORTLET_SCOPE);
        request.getPortletSession().setAttribute("row", row, PortletSession.PORTLET_SCOPE);
        request.setAttribute("pageId", pageId);
        request.setAttribute("totalCount", count);
        request.setAttribute("unreadCount", unread);
        request.setAttribute("pages", pages);
        request.setAttribute("row", row);
        request.setAttribute("mails", mails);
        if (request.getWindowState().equals(WindowState.MAXIMIZED))
          this.getPortletContext()
              .getRequestDispatcher(_PORTLET_JSP_PATH + "/email/emailPortletMaxView.jsp")
              .include(request, response);
        else
          this.getPortletContext()
              .getRequestDispatcher(_PORTLET_JSP_PATH + "/email/emailPortletView.jsp")
              .include(request, response);
      }
    } else {
      if (request.getParameter("mailId") != null) {
        int index = Integer.parseInt(request.getParameter("mailId"));
        List<MailBean> mails =
            (List<MailBean>)
                request.getPortletSession().getAttribute("mails", PortletSession.PORTLET_SCOPE);
        MailBean mail = mails.get(index);
        if (mail.getContent() == null) {
          PortletPreferences portletPreferences = request.getPreferences();
          String incomingType = portletPreferences.getValue("incomingType", null);
          String incoming = portletPreferences.getValue("incoming", null);
          String incomingPort = portletPreferences.getValue("incomingPort", null);
          String incomingSSL = portletPreferences.getValue("incomingSSL", null);
          String outgoing = portletPreferences.getValue("outgoing", null);
          String outgoingPort = portletPreferences.getValue("outgoingPort", null);
          String outgoingSSL = portletPreferences.getValue("outgoingSSL", null);
          String email = portletPreferences.getValue("email", null);
          String password = portletPreferences.getValue("password", null);
          EmailClient client =
              new EmailClient(
                  email,
                  password,
                  incomingType,
                  incoming,
                  incomingPort,
                  incomingSSL,
                  outgoing,
                  outgoingPort,
                  outgoingPort);
          try {
            mail = client.getMessageDetail(mails.get(index).getMsg());
            int unread =
                (Integer)
                    request
                        .getPortletSession()
                        .getAttribute("unreadCount", PortletSession.PORTLET_SCOPE);
            if (mails.get(index).getFlag() == 1) unread--;
            if (unread < 0) unread = 0;
            request
                .getPortletSession()
                .setAttribute("unreadCount", unread, PortletSession.PORTLET_SCOPE);
            // request.getPortletSession().removeAttribute("mails",PortletSession.PORTLET_SCOPE);
          } catch (Exception e) {
            request.setAttribute("error", e.getMessage());
          }
          mails.set(index, mail);
        }
        request.setAttribute("currentMail", mail);
        request.setAttribute("pageId", pageId);
      } else {

        List<MailBean> mails =
            (List<MailBean>)
                request.getPortletSession().getAttribute("mails", PortletSession.PORTLET_SCOPE);
        int row =
            (Integer) request.getPortletSession().getAttribute("row", PortletSession.PORTLET_SCOPE);
        int count =
            (Integer)
                request
                    .getPortletSession()
                    .getAttribute("totalCount", PortletSession.PORTLET_SCOPE);
        int unread =
            (Integer)
                request
                    .getPortletSession()
                    .getAttribute("unreadCount", PortletSession.PORTLET_SCOPE);
        int pages =
            (Integer)
                request.getPortletSession().getAttribute("pages", PortletSession.PORTLET_SCOPE);
        List<MailBean> pageMails = new ArrayList<MailBean>();
        request.setAttribute("pageId", pageId);
        request.setAttribute("totalCount", count);
        request.setAttribute("unreadCount", unread);
        request.setAttribute("pages", pages);
        request.setAttribute("row", row);
        request.setAttribute("mails", mails);
      }
      if (request.getWindowState().equals(WindowState.MAXIMIZED))
        this.getPortletContext()
            .getRequestDispatcher(_PORTLET_JSP_PATH + "/email/emailPortletMaxView.jsp")
            .include(request, response);
      else
        this.getPortletContext()
            .getRequestDispatcher(_PORTLET_JSP_PATH + "/email/emailPortletView.jsp")
            .include(request, response);
    }
  }
  public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
    try {
      String ctx = request.getContextPath();
      String defaultView = VIEW_PAGE;

      // Get portal items
      String queryString = (String) request.getAttribute(BASE_QUERY_STRING);
      IIndexerSearch searcher = (IIndexerSearch) request.getAttribute(SEARCHER);
      ProjectCategoryList categories =
          (ProjectCategoryList) request.getAttribute(PROJECT_CATEGORY_LIST);
      SearchBean searchBean = (SearchBean) request.getAttribute(SEARCH_BEAN);

      // Get preferences
      String category = request.getPreferences().getValue(PREF_CATEGORY_NAME, null);
      request.setAttribute(TITLE, request.getPreferences().getValue(TITLE, "Projects"));
      int recordLimit =
          Integer.parseInt(request.getPreferences().getValue(PREF_RECORD_LIMIT, "10"));
      request.setAttribute(RECORD_LIMIT, recordLimit);
      boolean hasPaging = "true".equals(request.getPreferences().getValue(PREF_HAS_PAGING, null));
      if (hasPaging) {
        request.setAttribute(HAS_PAGING, hasPaging);
      }

      if (category != null && categories.getIdFromValue(category) == -1) {
        // don't display anything because the category does not exist in the category list
      } else {
        // If the searchbean category is not this category, then provide a link to that category
        // page
        if (category != null && categories.getIdFromValue(category) != searchBean.getCategoryId()) {
          request.setAttribute(
              HAS_MORE_URL,
              request
                  .getPreferences()
                  .getValue(
                      PREF_HAS_MORE_URL,
                      searchBean.getUrlByCategory(categories.getIdFromValue(category))));
        } else {
          request.setAttribute(
              HAS_MORE_URL, request.getPreferences().getValue(PREF_HAS_MORE_URL, ""));
        }
        request.setAttribute(
            HAS_MORE_TITLE,
            request.getPreferences().getValue(PREF_HAS_MORE_TITLE, "Browse more items"));

        // Request items
        request.setAttribute(SEARCH_BEAN_ATTRIBUTE, searchBean);

        // Customize the string
        queryString +=
            " AND (type:project) "
                + (category != null
                    ? "AND (projectCategoryId:" + categories.getIdFromValue(category) + ") "
                    : "");

        // Efficient unsorted list
        /*
        TopDocCollector collector = new TopDocCollector(50);
        searcher.search(query, collector);
        ScoreDoc[] hits = collector.topDocs().scoreDocs;
        */

        //
        IndexerQueryResultList hits = new IndexerQueryResultList();
        hits.setQueryString(queryString);
        hits.getPagedListInfo().setItemsPerPage(recordLimit);

        // Use paging if requested
        PagedListInfo searchBeanInfo = new PagedListInfo();
        if (hasPaging) {
          searchBeanInfo.setLink("/search");
          String offsetStr = request.getParameter("offset");
          int offset = offsetStr == null ? 0 : Integer.parseInt(offsetStr);
          searchBeanInfo.setCurrentOffset(offset);
          searchBeanInfo.setRenderParameters(searchBean.getParameterMap());
          searchBeanInfo.setNamespace(response.getNamespace());
          searchBeanInfo.setContextPath(ctx);
          searchBeanInfo.setItemsPerPage(recordLimit);
          hits.setPagedListInfo(searchBeanInfo);
        }

        // Configure the parameters for the search results
        if (searchBean.getFilter() == SearchBean.NEWLY_ADDED) {
          // Newly Added (parse in reverse)
          hits.getPagedListInfo().setColumnToSortBy("entered");
          hits.getPagedListInfo().setSortOrder("desc");
          searcher.search(hits);
        } else if (searchBean.getFilter() == SearchBean.HIGHEST_RATED) {
          // Highest Rated (parse in reverse)
          hits.getPagedListInfo().setColumnToSortBy("ratingAverage");
          hits.getPagedListInfo().setSortOrder("desc");
          searcher.search(hits);
        } else if (searchBean.getFilter() == SearchBean.MOST_REVIEWED) {
          // Most Reviewed (parse in reverse)
          hits.getPagedListInfo().setColumnToSortBy("ratingCount");
          hits.getPagedListInfo().setSortOrder("desc");
          searcher.search(hits);
        } else {
          // Best Match
          searcher.search(hits);
        }

        if (hits.getPagedListInfo().moreRecordsExist()) {
          request.setAttribute(HAS_MORE_RECORDS, "true");
        }

        // Set the results for the view
        request.setAttribute(HITS, hits);

        // This portlet can provide data to other portlets
        for (String event : PortalUtils.getDashboardPortlet(request).getGenerateDataEvents()) {
          PortalUtils.setGeneratedData(request, event, hits);
        }

        if (hits.size() > 0) {
          // JSP view
          PortletContext context = getPortletContext();
          PortletRequestDispatcher requestDispatcher = context.getRequestDispatcher(defaultView);
          requestDispatcher.include(request, response);
        }
      }
    } catch (Exception e) {
      e.printStackTrace(System.out);
      throw new PortletException(e);
    }
  }
コード例 #24
0
  protected void doView(RenderRequest request, RenderResponse response)
      throws PortletException, java.io.IOException {
    String input = request.getParameter("input");
    String keyword = request.getParameter("keyword");
    String type = request.getParameter("type");
    String sort = request.getParameter("sort");
    String show = request.getParameter("show");
    if ("0".equals(input)) keyword = null;
    SearchCriteria criteria =
        (SearchCriteria)
            request.getPortletSession().getAttribute("criteria", PortletSession.APPLICATION_SCOPE);
    if (criteria == null)
      criteria = new SearchCriteria(OrganizationThreadLocal.getOrganizationId());
    if (!StringUtil.isEmpty(show))
      try {
        criteria.setRowPerPage(Integer.parseInt(show));
      } catch (Exception e) {
      }
    int page = 1;
    int number = 0;
    boolean pageChange = false;
    if (request.getParameter("page") != null) {
      try {
        page = Integer.parseInt(request.getParameter("page"));
        number = page * criteria.getRowPerPage();
        pageChange = true;
      } catch (Exception e) {
      }
    } else if (request.getParameter("number") != null) {
      try {
        number = Integer.parseInt(request.getParameter("number"));
        page = number / criteria.getRowPerPage();
        pageChange = true;
      } catch (Exception e) {
      }
    }
    criteria.setPage(page);
    if (!pageChange) {
      criteria.setKeyword(keyword);
      if (sort != null) criteria.setSort(sort);
    }
    SearchResult result = null;
    if (type == null) type = getDefaultType();
    try {
      if (type != null && !type.equals("all"))
        result = this.getSearcher(request).search(Class.forName(type), criteria);
      else result = this.getSearcher(request).search(criteria);
      request
          .getPortletSession()
          .setAttribute("criteria", criteria, PortletSession.APPLICATION_SCOPE);
    } catch (Exception e) {
      e.printStackTrace();
    }
    int total = result.getTotal();
    int rowPerPage = criteria.getRowPerPage();
    int pages = (total % rowPerPage == 0) ? total / rowPerPage : total / rowPerPage + 1;
    int start = (page - 1) * rowPerPage;
    int end = (page * rowPerPage < total) ? page * rowPerPage : total;

    JSONObject json = new JSONObject();
    try {
      json.put("view", "globalSearch.view");
      json.put("type", type);
      json.put("sort", criteria.getSort());
      json.put("show", criteria.getRowPerPage());
      json.put("keyword", StringUtil.isEmpty(criteria.getKeyword()) ? "" : criteria.getKeyword());
      json.put("items", getSearchResultsJSON(result.getItems()));
      json.put("total", total);
      json.put("pages", pages);
      json.put("page", page);
      json.put("start", start);
      json.put("end", end);
      int begin = page;
      if (begin - 5 > 0) begin -= 5;
      else begin = 1;
      int finish = pages;
      if (finish >= begin + 10) finish = begin + 9;
      JSONArray jArray = new JSONArray();
      for (int i = begin; i <= finish; i++) jArray.put(i);
      json.put("pageNumbers", jArray);
    } catch (Exception e) {
    }
    response.getWriter().write(json.toString());
  }
コード例 #25
0
	/**
	 * Processes the actual dispatching to the handler for render requests.
	 * <p>The handler will be obtained by applying the portlet's HandlerMappings in order.
	 * The HandlerAdapter will be obtained by querying the portlet's installed
	 * HandlerAdapters to find the first that supports the handler class.
	 * @param request current portlet render request
	 * @param response current portlet render response
	 * @throws Exception in case of any kind of processing failure
	 */
	@Override
	protected void doRenderService(RenderRequest request, RenderResponse response) throws Exception {
		if (logger.isDebugEnabled()) {
			logger.debug("DispatcherPortlet with name '" + getPortletName() + "' received render request");
		}

		HandlerExecutionChain mappedHandler = null;
		int interceptorIndex = -1;

		try {
			ModelAndView mv;
			try {
				// Determine handler for the current request.
				mappedHandler = getHandler(request);
				if (mappedHandler == null || mappedHandler.getHandler() == null) {
					noHandlerFound(request, response);
					return;
				}

				// Apply preHandle methods of registered interceptors.
				HandlerInterceptor[] interceptors = mappedHandler.getInterceptors();
				if (interceptors != null) {
					for (int i = 0; i < interceptors.length; i++) {
						HandlerInterceptor interceptor = interceptors[i];
						if (!interceptor.preHandleRender(request, response, mappedHandler.getHandler())) {
							triggerAfterRenderCompletion(mappedHandler, interceptorIndex, request, response, null);
							return;
						}
						interceptorIndex = i;
					}
				}

				// Check for forwarded exception from the action phase
				PortletSession session = request.getPortletSession(false);
				if (session != null) {
					if (request.getParameter(ACTION_EXCEPTION_RENDER_PARAMETER) != null) {
						Exception ex = (Exception) session.getAttribute(ACTION_EXCEPTION_SESSION_ATTRIBUTE);
						if (ex != null) {
							logger.debug("Render phase found exception caught during action phase - rethrowing it");
							throw ex;
						}
					}
					else {
						session.removeAttribute(ACTION_EXCEPTION_SESSION_ATTRIBUTE);
					}
				}

				// Actually invoke the handler.
				HandlerAdapter ha = getHandlerAdapter(mappedHandler.getHandler());
				mv = ha.handleRender(request, response, mappedHandler.getHandler());

				// Apply postHandle methods of registered interceptors.
				if (interceptors != null) {
					for (int i = interceptors.length - 1; i >= 0; i--) {
						HandlerInterceptor interceptor = interceptors[i];
						interceptor.postHandleRender(request, response, mappedHandler.getHandler(), mv);
					}
				}
			}
			catch (ModelAndViewDefiningException ex) {
				logger.debug("ModelAndViewDefiningException encountered", ex);
				mv = ex.getModelAndView();
			}
			catch (Exception ex) {
				Object handler = (mappedHandler != null ? mappedHandler.getHandler() : null);
				mv = processHandlerException(request, response, handler, ex);
			}

			// Did the handler return a view to render?
			if (mv != null && !mv.isEmpty()) {
				render(mv, request, response);
			}
			else {
				if (logger.isDebugEnabled()) {
					logger.debug("Null ModelAndView returned to DispatcherPortlet with name '" +
							getPortletName() + "': assuming HandlerAdapter completed request handling");
				}
			}

			// Trigger after-completion for successful outcome.
			triggerAfterRenderCompletion(mappedHandler, interceptorIndex, request, response, null);
		}

		catch (Exception ex) {
			// Trigger after-completion for thrown exception.
			triggerAfterRenderCompletion(mappedHandler, interceptorIndex, request, response, ex);
			throw ex;
		}
		catch (Error err) {
			PortletException ex =
					new PortletException("Error occured during request processing: " + err.getMessage(), err);
			// Trigger after-completion for thrown exception.
			triggerAfterRenderCompletion(mappedHandler, interceptorIndex, request, response, ex);
			throw ex;
		}
	}
コード例 #26
0
  @SuppressWarnings("unchecked")
  @RenderMode(name = "VIEW")
  public void showBooks(RenderRequest request, RenderResponse response)
      throws IOException, PortletException {
    logger.info("Entering showBooks method");
    PortalContext context = request.getPortalContext();
    printSupportedPortletModes(context);
    printSupportedWindowStates(context);

    // --get user attributes user.name.given and user.name.family
    Map<String, Object> userAttributeMap =
        (Map<String, Object>) request.getAttribute(PortletRequest.USER_INFO);
    String firstName = "";
    String lastName = "";
    if (userAttributeMap != null) {
      firstName = (String) userAttributeMap.get("user.name.given");
      lastName = (String) userAttributeMap.get("user.name.family");
      request.setAttribute("firstName", firstName);
      request.setAttribute("lastName", lastName);
    }

    String portalInfo = context.getPortalInfo();
    request.setAttribute("portalInfo", portalInfo);

    // --generate all the URLs that will be used by the portlet
    generateUrls(request, response);

    String myaction = request.getParameter("myaction");
    if (myaction != null) {
      logger.info("myaction parameter is not null. Value is " + myaction);
      request.getPortletSession().setAttribute("myaction", myaction, PortletSession.PORTLET_SCOPE);
    } else {
      // -- if myaction is NULL then show the home page of Book
      // catalog
      // page
      request
          .getPortletSession()
          .setAttribute("myaction", "showCatalog", PortletSession.PORTLET_SCOPE);
    }

    // -- send myaction as a request attribute to the BookServlet.
    request.setAttribute("myaction", request.getPortletSession().getAttribute("myaction"));

    // --dynamically obtain the title for the portlet, based on myaction
    String titleKey =
        "portlet.title." + (String) request.getPortletSession().getAttribute("myaction");
    response.setTitle(getResourceBundle(request.getLocale()).getString(titleKey));

    // --if the action is uploadTocForm then store the ISBN number of
    // the
    // --book for which the TOC is being uploaded. The upload action
    // will use the ISBN number to create file name -- refer home.jsp
    // page
    if (((String) request.getAttribute("myaction")).equalsIgnoreCase("uploadTocForm")) {
      request.getPortletSession().setAttribute("isbnNumber", request.getParameter("isbnNumber"));
    }

    if (((String) request.getPortletSession().getAttribute("myaction"))
        .equalsIgnoreCase("showSearchResults")) {
      request.setAttribute(
          "matchingBooks", request.getPortletSession().getAttribute("matchingBooks"));
    }

    // its important to encode URLs
    PortletRequestDispatcher dispatcher =
        request
            .getPortletSession()
            .getPortletContext()
            .getRequestDispatcher(response.encodeURL("/myservlet/bookServlet"));
    dispatcher.include(request, response);
  }
  @Override
  public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
    try {
      String view = VIEW_FORM_PAGE;
      String viewType = request.getParameter("viewType");
      if (viewType == null) {
        viewType = (String) request.getPortletSession().getAttribute("viewType");
      }
      // Set global preferences
      request.setAttribute(TITLE, request.getPreferences().getValue(PREF_TITLE, null));
      request.setAttribute(
          INTRODUCTION_MESSAGE, request.getPreferences().getValue(PREF_INTRODUCTION_MESSAGE, null));

      User user = PortalUtils.getUser(request);
      Project project = PortalUtils.getProject(request);

      Task task = (Task) request.getPortletSession().getAttribute("task");

      int projectId = project == null ? -1 : project.getId();
      String projectIdOfLists = request.getParameter(PROJECT_ID_OF_LISTS);
      int pidOfLists = projectIdOfLists == null ? -1 : Integer.parseInt(projectIdOfLists);

      LOG.debug("doView: pidOfLists -- " + pidOfLists);

      // Clean up session
      request.getPortletSession().removeAttribute(VIEW_TYPE);
      request.getPortletSession().removeAttribute(PROJECT_ID_OF_LISTS);

      if (SAVE_FAILURE.equals(viewType)) {
        // Prep the form to show errors...
        request.setAttribute(
            ACTION_ERROR, request.getPreferences().getValue(PREF_FAILURE_MESSAGE, null));
        // Show the form with any errors provided
        PortalUtils.processErrors(request, task.getErrors());
      } else if (SAVE_SUCCESS.equals(viewType)) {
        // Save Success
        request.setAttribute(
            SUCCESS_MESSAGE, request.getPreferences().getValue(PREF_SUCCESS_MESSAGE, null));
        view = VIEW_MESSAGE_PAGE;
      } else {
        if (!user.isLoggedIn()) {
          // If user is not logged in, redirect
          view = VIEW_MESSAGE_PAGE;
          request.setAttribute(ACTION_ERROR, "You need to be logged in to perform this action");
        } else if (projectId <= 0) {
          request.setAttribute(ACTION_ERROR, "No project was specified");
          view = VIEW_MESSAGE_PAGE;
        } else {
          view = VIEW_FORM_PAGE;
          try {
            Connection db = PortalUtils.useConnection(request);

            int userProfileId = user.getProfileProjectId();
            Project userProfile;
            if (userProfileId == -1) {
              view = VIEW_MESSAGE_PAGE;
              request.setAttribute(ACTION_ERROR, "No profile is available to bookmark.");
            } else {
              userProfile = ProjectUtils.loadProject(userProfileId);
              if (pidOfLists == -1) {
                pidOfLists = userProfile.getId();
              }
              // check the user has permissions to add/delete from lists for the project whose lists
              // are being modified
              // these will be used by the view to dynamically show/hide functionality
              request.setAttribute(
                  CAN_ADD_LIST, ProjectUtils.hasAccess(pidOfLists, user, "project-lists-add"));
              request.setAttribute(
                  CAN_DELETE_FROM_LIST,
                  ProjectUtils.hasAccess(pidOfLists, user, "project-lists-delete"));

              ProjectList projectList = findUserProjects(db, user);
              ProjectList availableProjects = new ProjectList();
              // Profile needs to appear on top so remove it from list and don't add twice
              availableProjects.add(userProfile);
              for (int i = 0; i != projectList.size(); i++) {
                Project p = projectList.get(i);
                if (p.getId() != userProfile.getId()) {
                  availableProjects.add(p);
                }
              }

              TaskCategoryList availableLists = getAvailableLists(db, pidOfLists);

              String errorMessage = (String) request.getPortletSession().getAttribute(ACTION_ERROR);
              if (StringUtils.hasText(errorMessage)) {
                request.setAttribute(ACTION_ERROR, errorMessage);
              }

              Map<Integer, TaskCategory> usedLists =
                  findExistingTaskCategorysForProjects(db, pidOfLists, project.getId());
              request.setAttribute(PROJECT_ID_OF_LISTS, pidOfLists);
              request.setAttribute(PROJECT, project);
              request.setAttribute(AVAILABLE_LISTS, availableLists);
              request.setAttribute(USER_PROFILE, userProfile);
              request.setAttribute(AVAILABLE_PROJECTS, availableProjects);
              request.setAttribute(USED_LIST_MAP, usedLists);
            }
          } catch (SQLException e) {
            e.printStackTrace();
            view = VIEW_MESSAGE_PAGE;
            request.setAttribute(
                ACTION_ERROR, "An error occurred processing your request. Please try again.");
          }
        }
      }
      // Clean up session
      request.getPortletSession().removeAttribute(ACTION_ERROR);
      PortletContext context = getPortletContext();
      PortletRequestDispatcher requestDispatcher = context.getRequestDispatcher(view);
      requestDispatcher.include(request, response);
    } catch (Exception e) {
      e.printStackTrace();
      throw new PortletException(e);
    }
  }
コード例 #28
0
 private void setRenderAttributes(RenderRequest request) {
   String currentURL = defaultURL;
   request
       .getPortletSession()
       .setAttribute("default_url", defaultURL, request.getPortletSession().APPLICATION_SCOPE);
   request.setAttribute("default_url", defaultURL);
   if (hide_url) request.setAttribute("hide_url", "");
   else request.removeAttribute("hide_url");
   if (hide_new_windows) request.setAttribute("hide_new_windows", "");
   else request.removeAttribute("hide_new_windows");
   if (request.getParameter("height") != null)
     request.setAttribute("height", request.getParameter("height"));
   else request.setAttribute("height", PortletWebBrowser.defaultHeight);
   if (request.getParameter("width") != null)
     request.setAttribute("width", request.getParameter("width"));
   else request.setAttribute("width", PortletWebBrowser.defaultWidth);
   if (request.getParameter("message") != null)
     request.setAttribute("message", request.getParameter("message"));
   else request.setAttribute("message", PortletWebBrowser.defaultMessage);
   if (request.getPortletSession().getAttribute("current_url") != null)
     currentURL = (String) request.getPortletSession().getAttribute("current_url");
   request.setAttribute("url", currentURL);
   // String _clean_html = HTMLmanager.getCleanHTML(currentURL);
   // //HTMLParser.toStringFromHTML(currentURL) ;
   HTMLPage toBrowse = new HTMLPage(currentURL);
   String html = toBrowse.getBody();
   // on set la liste de highlights
   ArrayList<HighlightSelectionHTML> _highlights;
   if (request.getPortletSession().getAttribute("highlights") != null)
     _highlights =
         ((ArrayList<HighlightSelectionHTML>)
             request.getPortletSession().getAttribute("highlights"));
   else _highlights = new ArrayList<HighlightSelectionHTML>();
   // String _html_to_load = HTMLmanager.colorHighlights(_clean_html, _highlights);
   for (HighlightSelectionHTML highlight : _highlights) {
     try {
       toBrowse.addAnnotationSpan(
           highlight.getSelection().getXpointerBegin(),
           highlight.getSelection().getXpointerEnd(),
           highlight.getStyle(),
           highlight.getInfo(),
           highlight.getId());
       if (toBrowse.getBody() != null) html = toBrowse.getBody();
       // System.out.println("[PortletBrowser.setRenderAttributes] html : " + html);
     } catch (ParserException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       System.out.println(
           "[PortletWebBrowser.setRenderAttributes] unable to parse HTML and add annotations for URL : "
               + currentURL);
     }
   }
   // String _html_to_load = toBrowse.getBody();
   String _html_to_load = html;
   if (_html_to_load != null && _html_to_load.length() > 0)
     request.setAttribute("html", _html_to_load);
   // else request.setAttribute("html" , _clean_html);
   else
     request.setAttribute(
         "html",
         "Problem Parsing HTML, try to reload page without annotations or selections ... or just reload ^^");
   // Add Css
   request.setAttribute("css", toBrowse.getCss());
 }