Package org.ametys.web
Class WebHelper
java.lang.Object
org.ametys.web.WebHelper
Helper for web
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringfindLanguage(Request request) Find the language to use from request or defaultstatic SiteRetrieves the site from an observationEvent.
This method search in the events' arguments to find :
ObservationConstants.ARGS_SITEObservationConstants.ARGS_PAGEObservationConstants.ARGS_ZONE_ITEMObservationConstants.ARGS_ACL_CONTEXTobjectif it's instance ofSiteAwareAmetysObjectstatic StringgetSiteName(Request request) Get the site name from the request.static StringgetSiteName(Request request, AmetysObject object) Get the site name from a object or current request.static voidsetPopulationContextAttribute(Request request, Site site) Set the population context attribute from the given site in the request
-
Method Details
-
getSiteName
Get the site name from the request. The site name is searched in the following order: the 'siteName' request parameter, the 'site' request attribute, the 'siteName' request attribute.- Parameters:
request- the request. Cannot be null.- Returns:
- the site name or
nullif not found
-
getSiteName
Get the site name from a object or current request. The site name is searched in the following order: the Ametys object, the 'siteName' request parameter, the 'site' request attribute, the 'siteName' request attribute.- Parameters:
request- the request. Cannot be null.object- the object. Can be null.- Returns:
- the site name or
nullif not found
-
findSite
Retrieves the site from an observationEvent.
This method search in the events' arguments to find :
ObservationConstants.ARGS_SITEObservationConstants.ARGS_PAGEObservationConstants.ARGS_ZONE_ITEMObservationConstants.ARGS_ACL_CONTEXTobjectif it's instance ofSiteAwareAmetysObject
- Parameters:
event- theEvent.- Returns:
- the current site or null if not found.
-
setPopulationContextAttribute
Set the population context attribute from the given site in the request- Parameters:
request- the requestsite- the site. Can be null. In this case, take the site in the request
-
findLanguage
Find the language to use from request or default- Parameters:
request- The request- Returns:
- The language found in "lang" request parameter of default language
-