Class NewsletterUtils
- java.lang.Object
-
- fr.paris.lutece.plugins.newsletter.util.NewsletterUtils
-
public final class NewsletterUtils extends java.lang.ObjectThis classe provides utility methods for newsletters.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddHeaderResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String strFileName, java.lang.String strFileExtension)Addition of information as header of the http responsestatic voidaddParameters(fr.paris.lutece.util.url.UrlItem urlItem, java.lang.String strParameterName, java.lang.String[] values)Adds all parameter values to the urlItemstatic java.lang.StringconvertForJavascript(java.lang.String strIn)Cleans a string in order to make it usable in a javascript scriptstatic java.lang.StringencodeForURL(java.lang.String strEntry)Encode a string for passage in parameter in URLstatic java.lang.StringgetHtmlTemplatePath(int nTemplateId, fr.paris.lutece.portal.service.plugin.Plugin plugin)Retrieve the html template for the given template idstatic java.util.LocalegetLocale(javax.servlet.ServletRequest request)static java.lang.StringgetStringFromStringArray(java.lang.String[] strArrayValues)Get the first String of a String array.static java.lang.StringrewriteUrls(java.lang.String strContent, java.lang.String strBaseUrl)Rewrite relatives url to absolutes urls
-
-
-
Method Detail
-
getHtmlTemplatePath
public static java.lang.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
public static java.lang.String convertForJavascript(java.lang.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 java.lang.String encodeForURL(java.lang.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, java.lang.String strFileName, java.lang.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, java.lang.String strParameterName, java.lang.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
public static java.lang.String getStringFromStringArray(java.lang.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 java.lang.String rewriteUrls(java.lang.String strContent, java.lang.String strBaseUrl)Rewrite relatives url to absolutes urls- Parameters:
strContent- The content to analyzestrBaseUrl- The base url- Returns:
- The converted content
-
getLocale
public static java.util.Locale getLocale(javax.servlet.ServletRequest request)
-
-