Class DefaultAirlineWsContextInformationLoaderV2
- All Implemented Interfaces:
AirlineContextInformationLoader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionde.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy<BaseSiteModel>Gets the activate BaseSite In SessionStrategyGets baseSiteResourceExceptions.de.hybris.platform.site.BaseSiteServiceGets baseSiteService.de.hybris.platform.store.services.BaseStoreServiceGets base store service.de.hybris.platform.order.CalculationServiceGets the calculation servicede.hybris.platform.order.CartServiceGets cart service.de.hybris.platform.commerceservices.i18n.CommerceCommonI18NServiceGets commerceCommonI18NService.de.hybris.platform.servicelayer.i18n.CommonI18NServiceGets commonI18NService.de.hybris.platform.servicelayer.config.ConfigurationServiceGets configurationService.protected ErrorCodeResolverGets error code resolver.protected String[]Gets excluded urls.protected StringgetRequestMapping(String queryString) Get the request mapping from the input.protected String[]get the special url characters from the configuration.protected Collection<LanguageModel>getStoresLanguages(BaseStoreModel currentBaseStore) Gets the stores languages from the base store.initializeSiteFromRequest(javax.servlet.http.HttpServletRequest request) Method resolves base site uid from request URL and set it as current site i.e
/rest/v1/mysite/cart, or
/rest/v1/mysite/customers/current
would try to set base site with uid=mysite as a current site.protected booleanisExcludedURL(String path) This method check whether the given path is part of excluded url as configured in the properties file.protected booleanisNotBaseSiteResource(String requestMapping) Validates the input for baseSite resource exception.protected StringparseBaseSiteId(String requestMapping) Get the baseSiteId from the request mapping.voidsetActivateBaseSiteInSessionStrategy(de.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy<BaseSiteModel> activateBaseSiteInSessionStrategy) Sets the activate BaseSite In SessionStrategyvoidsetBaseSiteResourceExceptions(Set<String> baseSiteResourceExceptions) Sets the baseSiteResourceExceptionsvoidsetBaseSiteService(de.hybris.platform.site.BaseSiteService baseSiteService) Sets the base Site ServicevoidsetBaseStoreService(de.hybris.platform.store.services.BaseStoreService baseStoreService) Sets the base store ServicevoidsetCalculationService(de.hybris.platform.order.CalculationService calculationService) Sets the calculationServicevoidsetCartService(de.hybris.platform.order.CartService cartService) Sets the cart servicevoidsetCommerceCommonI18NService(de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService commerceCommonI18NService) Sets the commerce Common I18N ServicevoidsetCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService) Sets the common I18N ServicevoidsetConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService) Sets the configurationServicesetCurrencyFromRequest(javax.servlet.http.HttpServletRequest request) Method set current currency based on information from request and recalculate cart for current sessionprotected voidsetCurrentBaseSite(BaseSiteModel baseSiteModel) Sets the given bases site in the session.voidsetErrorCodeResolver(ErrorCodeResolver errorCodeResolver) Sets error code resolver.setLanguageFromRequest(javax.servlet.http.HttpServletRequest request) This method sets the locale language from Accept-Language in the Request Header.
-
Constructor Details
-
DefaultAirlineWsContextInformationLoaderV2
public DefaultAirlineWsContextInformationLoaderV2()
-
-
Method Details
-
setLanguageFromRequest
public LanguageModel setLanguageFromRequest(javax.servlet.http.HttpServletRequest request) throws UnsupportedLanguageWsException This method sets the locale language from Accept-Language in the Request Header. Examples of Accept-Language syntax: Accept-Language: de Accept-Language: de-CH Accept-Language: en-US,en;q=0.5 Accept-Language: fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5 (Multiple types, weighted with the quality value syntax)- Specified by:
setLanguageFromRequestin interfaceAirlineContextInformationLoader- Parameters:
request- the request from which we should get language information- Returns:
- the language to be set in the system
- Throws:
UnsupportedLanguageWsException
-
setCurrencyFromRequest
public CurrencyModel setCurrencyFromRequest(javax.servlet.http.HttpServletRequest request) throws UnsupportedCurrencyWsException, RecalculationWsException Description copied from interface:AirlineContextInformationLoaderMethod set current currency based on information from request and recalculate cart for current session- Specified by:
setCurrencyFromRequestin interfaceAirlineContextInformationLoader- Parameters:
request- - request from which we should get currency information- Returns:
- currency set as current
- Throws:
UnsupportedCurrencyWsExceptionRecalculationWsException
-
initializeSiteFromRequest
public BaseSiteModel initializeSiteFromRequest(javax.servlet.http.HttpServletRequest request) throws InvalidResourceWsException Method resolves base site uid from request URL and set it as current site i.e
/rest/v1/mysite/cart, or
/rest/v1/mysite/customers/current
would try to set base site with uid=mysite as a current site.
One should define the path which is expected to be before the site resource in the project properties file (commercewebservices.rootcontext).
Default and fallback value equals to /rest/v1/
Method uses also a comma separated list of url special characters that are used to parse the site id resource. You can reconfigure it in properties file (commercewebservices.url.special.characters). The default and fallback value is equal to "?,/".
Method will throw
InvalidResourceExceptionif it fails to find the site which is in the resource url.
However, you can configure exceptions that doesn't require the site mapping in the resource path. You can configure them in a spring bean called 'baseFilterResourceExceptions'.- Specified by:
initializeSiteFromRequestin interfaceAirlineContextInformationLoader- Parameters:
request- - request from which we should get base site uid- Returns:
- baseSite set as current site or null
- Throws:
InvalidResourceWsException
-
getRequestMapping
Get the request mapping from the input.- Parameters:
queryString-- Returns:
- request mapping
-
isNotBaseSiteResource
Validates the input for baseSite resource exception.- Parameters:
requestMapping-- Returns:
- true if url is not base site resource
-
parseBaseSiteId
Get the baseSiteId from the request mapping.- Parameters:
requestMapping-- Returns:
- baseSiteId
-
getSpecialUrlCharacters
get the special url characters from the configuration.- Returns:
- special url characters
-
setCurrentBaseSite
Sets the given bases site in the session.- Parameters:
baseSiteModel-
-
isExcludedURL
This method check whether the given path is part of excluded url as configured in the properties file.- Parameters:
path-- Returns:
- true if url is excluded
-
getExcludedUrls
Gets excluded urls.- Returns:
- excluded url
-
getStoresLanguages
Gets the stores languages from the base store.- Parameters:
currentBaseStore-- Returns:
- languages
-
getConfigurationService
public de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService()Gets configurationService.- Returns:
- the configuration service
-
setConfigurationService
public void setConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService) Sets the configurationService- Parameters:
configurationService-
-
getBaseSiteResourceExceptions
Gets baseSiteResourceExceptions.- Returns:
- the base Site Resource Exceptions
-
setBaseSiteResourceExceptions
Sets the baseSiteResourceExceptions- Parameters:
baseSiteResourceExceptions-
-
getBaseSiteService
public de.hybris.platform.site.BaseSiteService getBaseSiteService()Gets baseSiteService.- Returns:
- the base site Service
-
setBaseSiteService
public void setBaseSiteService(de.hybris.platform.site.BaseSiteService baseSiteService) Sets the base Site Service- Parameters:
baseSiteService-
-
getActivateBaseSiteInSessionStrategy
public de.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy<BaseSiteModel> getActivateBaseSiteInSessionStrategy()Gets the activate BaseSite In SessionStrategyreturn activateBaseSiteInSessionStrategy
-
setActivateBaseSiteInSessionStrategy
public void setActivateBaseSiteInSessionStrategy(de.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy<BaseSiteModel> activateBaseSiteInSessionStrategy) Sets the activate BaseSite In SessionStrategy- Parameters:
activateBaseSiteInSessionStrategy-
-
getCommonI18NService
public de.hybris.platform.servicelayer.i18n.CommonI18NService getCommonI18NService()Gets commonI18NService.- Returns:
- the commonI18NService
-
setCommonI18NService
public void setCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService) Sets the common I18N Service- Parameters:
commonI18NService-
-
getCommerceCommonI18NService
public de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService getCommerceCommonI18NService()Gets commerceCommonI18NService.- Returns:
- the commerce Common I18NService
-
setCommerceCommonI18NService
public void setCommerceCommonI18NService(de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService commerceCommonI18NService) Sets the commerce Common I18N Service- Parameters:
commerceCommonI18NService-
-
getBaseStoreService
public de.hybris.platform.store.services.BaseStoreService getBaseStoreService()Gets base store service.- Returns:
- the base store service
-
setBaseStoreService
public void setBaseStoreService(de.hybris.platform.store.services.BaseStoreService baseStoreService) Sets the base store Service- Parameters:
baseStoreService-
-
getCartService
public de.hybris.platform.order.CartService getCartService()Gets cart service.- Returns:
- the cart service
-
setCartService
public void setCartService(de.hybris.platform.order.CartService cartService) Sets the cart service- Parameters:
cartService-
-
getCalculationService
public de.hybris.platform.order.CalculationService getCalculationService()Gets the calculation service- Returns:
- calculationService
-
setCalculationService
public void setCalculationService(de.hybris.platform.order.CalculationService calculationService) Sets the calculationService- Parameters:
calculationService-
-
getErrorCodeResolver
Gets error code resolver.- Returns:
- the error code resolver
-
setErrorCodeResolver
Sets error code resolver.- Parameters:
errorCodeResolver- the error code resolver
-