Class NewsletterUtils

java.lang.Object
fr.paris.lutece.plugins.newsletter.util.NewsletterUtils

public final class NewsletterUtils extends Object
This classe provides utility methods for newsletters.
  • Method Details

    • getHtmlTemplatePath

      public static String getHtmlTemplatePath(int nTemplateId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Retrieve the html template for the given template id
      Parameters:
      nTemplateId - the id of the template to retrieve
      plugin - the plugin
      Returns:
      the html template to use of null if no NewsletterTemplate found for this Id
    • convertForJavascript

      public static String convertForJavascript(String strIn)
      Cleans a string in order to make it usable in a javascript script
      Parameters:
      strIn - the string to clean
      Returns:
      the javascript escaped String
    • encodeForURL

      public static String encodeForURL(String strEntry)
      Encode a string for passage in parameter in URL
      Parameters:
      strEntry - the string entry
      Returns:
      the string encoding
    • addHeaderResponse

      public static void addHeaderResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String strFileName, String strFileExtension)
      Addition of information as header of the http response
      Parameters:
      request - The Http Request
      response - The Http Response
      strFileName - THe filename of the file
      strFileExtension - The file extension
    • addParameters

      public static void addParameters(fr.paris.lutece.util.url.UrlItem urlItem, String strParameterName, String[] values)
      Adds all parameter values to the urlItem
      Parameters:
      urlItem - the urlItem
      strParameterName - the name of the parameter which has multiple values
      values - parameter values
    • getStringFromStringArray

      public static String getStringFromStringArray(String[] strArrayValues)
      Get the first String of a String array. If the array is null, or if it has no element, then return null.
      Parameters:
      strArrayValues - The string array to get the first element of.
      Returns:
      The first element of the array, or null if the array has no element or is null.
    • rewriteUrls

      public static String rewriteUrls(String strContent, String strBaseUrl)
      Rewrite relatives url to absolutes urls
      Parameters:
      strContent - The content to analyze
      strBaseUrl - The base url
      Returns:
      The converted content
    • getLocale

      public static Locale getLocale(javax.servlet.ServletRequest request)