Class NewsletterUtils
java.lang.Object
fr.paris.lutece.plugins.newsletter.util.NewsletterUtils
This classe provides utility methods for newsletters.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddHeaderResponse(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String strFileName, String strFileExtension) Addition of information as header of the http responsestatic voidaddParameters(fr.paris.lutece.util.url.UrlItem urlItem, String strParameterName, String[] values) Adds all parameter values to the urlItemstatic StringconvertForJavascript(String strIn) Cleans a string in order to make it usable in a javascript scriptstatic StringencodeForURL(String strEntry) Encode a string for passage in parameter in URLstatic StringgetHtmlTemplatePath(int nTemplateId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Retrieve the html template for the given template idstatic LocalegetLocale(jakarta.servlet.ServletRequest request) static StringgetStringFromStringArray(String[] strArrayValues) Get the first String of a String array.static StringrewriteUrls(String strContent, String strBaseUrl) Rewrite relatives url to absolutes urls
-
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 retrieveplugin- the plugin- Returns:
- the html template to use of null if no NewsletterTemplate found for this Id
-
convertForJavascript
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
Encode a string for passage in parameter in URL- Parameters:
strEntry- the string entry- Returns:
- the string encoding
-
addHeaderResponse
public static void addHeaderResponse(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String strFileName, String strFileExtension) Addition of information as header of the http response- Parameters:
request- The Http Requestresponse- The Http ResponsestrFileName- THe filename of the filestrFileExtension- 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 urlItemstrParameterName- the name of the parameter which has multiple valuesvalues- parameter values
-
getStringFromStringArray
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
Rewrite relatives url to absolutes urls- Parameters:
strContent- The content to analyzestrBaseUrl- The base url- Returns:
- The converted content
-
getLocale
-