Exemplo n.º 1
0
  /** Serve up the custom <code>config</code> mode. */
  protected void doCustomConfigure(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
    // Set the MIME type for the render response
    response.setContentType(request.getResponseContentType());

    // Invoke the JSP to render
    PortletRequestDispatcher rd =
        getPortletContext().getRequestDispatcher(getJspFilePath(request, CONFIG_JSP));
    rd.include(request, response);
  }
Exemplo n.º 2
0
  /**
   * Serve up the <code>view</code> mode.
   *
   * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest,
   *     javax.portlet.RenderResponse)
   */
  public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
    // Set the MIME type for the render response
    response.setContentType(request.getResponseContentType());

    // Invoke the JSP to render
    PortletRequestDispatcher rd =
        getPortletContext().getRequestDispatcher(getJspFilePath(request, VIEW_JSP));
    rd.include(request, response);
  }
 /** Include a page. */
 private void include(RenderRequest request, RenderResponse response, String pageName)
     throws PortletException {
   response.setContentType(request.getResponseContentType());
   if (!StringUtil.isDefined(pageName)) {
     throw new NullPointerException("null or empty page name");
   }
   try {
     PortletRequestDispatcher dispatcher =
         getPortletContext().getRequestDispatcher("/portlets/jsp/lastPublications/" + pageName);
     dispatcher.include(request, response);
   } catch (IOException ioe) {
     log("Could not include a page", ioe);
     throw new PortletException(ioe);
   }
 }
Exemplo n.º 4
0
  /**
   * Serve up the <code>edit</code> mode.
   *
   * @see javax.portlet.GenericPortlet#doEdit(javax.portlet.RenderRequest,
   *     javax.portlet.RenderResponse)
   */
  public void doEdit(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
    // Set the MIME type for the render response
    response.setContentType(request.getResponseContentType());

    // Check if portlet session exists
    Vlado2PortletSessionBean sessionBean = getSessionBean(request);
    if (sessionBean == null) {
      response.getWriter().println("<b>NO PORTLET SESSION YET</b>");
      return;
    }

    // Invoke the JSP to render
    PortletRequestDispatcher rd =
        getPortletContext().getRequestDispatcher(getJspFilePath(request, EDIT_JSP));
    rd.include(request, response);
  }
Exemplo n.º 5
0
  /**
   * Serve up the <code>view</code> mode.
   *
   * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest,
   *     javax.portlet.RenderResponse)
   */
  public void doView(RenderRequest request, RenderResponse response)
      throws PortletException, IOException {
    // Set the MIME type for the render response
    response.setContentType(request.getResponseContentType());
    HttpServletRequest req = (HttpServletRequest) request;
    ServletRequest sreq = (ServletRequest) request;
    System.out.println("TEST--->" + req.getQueryString());
    System.out.println("TEST2--->" + sreq.getParameter("param"));
    // Check if portlet session exists
    Vlado2PortletSessionBean sessionBean = getSessionBean(request);
    if (sessionBean == null) {
      response.getWriter().println("<b>NO PORTLET SESSION YET</b>");
      return;
    }

    // Invoke the JSP to render
    PortletRequestDispatcher rd =
        getPortletContext().getRequestDispatcher(getJspFilePath(request, VIEW_JSP));
    rd.include(request, response);
  }
Exemplo n.º 6
0
 /**
  * Returns JSP file path.
  *
  * @param request Render request
  * @param jspFile JSP file name
  * @return JSP file path
  */
 private static String getJspFilePath(RenderRequest request, String jspFile) {
   String markup = request.getProperty("wps.markup");
   if (markup == null) markup = getMarkup(request.getResponseContentType());
   return JSP_FOLDER + markup + "/" + jspFile + "." + getJspExtension(markup);
 }