Class PortletHtmlContent

java.lang.Object
fr.paris.lutece.portal.business.portlet.Portlet
fr.paris.lutece.portal.business.portlet.PortletHtmlContent
All Implemented Interfaces:
XmlContent

public abstract class PortletHtmlContent extends Portlet
Base class of the portlets whose content is HTML, rendered with a FreeMarker template rather than through an XML/XSL transformation.

The template is the one chosen for the portlet among the PortletTemplate registered for its type in the back office; a portlet without a valid template falls back on the default template given by the subclass. Subclasses build their model with createPortletModel() and render it with renderTemplate(HttpServletRequest, String, Map).

  • Field Details

    • MARK_PORTLET

      public static final String MARK_PORTLET
      Mark of the portlet itself
      See Also:
    • MARK_PORTLET_ID

      public static final String MARK_PORTLET_ID
      Mark of the portlet identifier
      See Also:
    • MARK_PORTLET_NAME

      public static final String MARK_PORTLET_NAME
      Mark of the portlet name, present only when the title has to be displayed
      See Also:
    • MARK_DEVICE_CLASS

      public static final String MARK_DEVICE_CLASS
      Mark of the CSS classes hiding the portlet on the devices it must not be displayed on
      See Also:
  • Constructor Details

    • PortletHtmlContent

      public PortletHtmlContent()
  • Method Details

    • getHtmlContent

      public abstract String getHtmlContent(jakarta.servlet.http.HttpServletRequest request)
      Returns the HTML content of the portlet
      Overrides:
      getHtmlContent in class Portlet
      Parameters:
      request - The HTTP request
      Returns:
      the HTML content
    • getTemplatePath

      public String getTemplatePath(String strDefaultTemplatePath)
      Returns the path of the FreeMarker template to render this portlet with : the template chosen for the portlet when it is valid, the given default otherwise
      Parameters:
      strDefaultTemplatePath - the default template of the portlet type
      Returns:
      the template path, relative to the WEB-INF/templates directory
      See Also:
    • getDeviceDisplayClass

      public String getDeviceDisplayClass()
      Returns the Bootstrap display classes hiding the portlet on the devices it must not be displayed on, computed from the device display flags
      Returns:
      the CSS classes, an empty string when the portlet is displayed on every device
    • getXml

      public String getXml(jakarta.servlet.http.HttpServletRequest request) throws SiteMessageException
      This method should return the body of an Xml document providing the content
      Parameters:
      request - The HTTP Servlet Request
      Returns:
      string The String
      Throws:
      SiteMessageException - occurs when a site message need to be displayed
    • getXmlDocument

      public String getXmlDocument(jakarta.servlet.http.HttpServletRequest request) throws SiteMessageException
      This method should return the whole Xml document providing the content (including the header)
      Parameters:
      request - The HTTP Servlet Request
      Returns:
      string The String
      Throws:
      SiteMessageException - occurs when a site message need to be displayed
    • isContentGeneratedByXmlAndXsl

      public boolean isContentGeneratedByXmlAndXsl()
      Check if the content of this portlet is generated by xml and xsl, or if it manage its own content generation
      Overrides:
      isContentGeneratedByXmlAndXsl in class Portlet
      Returns:
      True if the content must be generated from XML and XSL, false if it must be generated by the Portlet.getHtmlContent(HttpServletRequest request) method