Class DefaultTmaContextInformationLoader
java.lang.Object
de.hybris.platform.b2ctelcowebservices.context.impl.DefaultTmaContextInformationLoader
- All Implemented Interfaces:
TmaContextInformationLoader
public class DefaultTmaContextInformationLoader
extends Object
implements TmaContextInformationLoader
Default context information loader
- Since:
- 1810
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionde.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategyde.hybris.platform.site.BaseSiteServicede.hybris.platform.store.services.BaseStoreServicede.hybris.platform.order.CalculationServicede.hybris.platform.order.CartServicede.hybris.platform.commerceservices.i18n.CommerceCommonI18NServicede.hybris.platform.servicelayer.i18n.CommonI18NServicede.hybris.platform.servicelayer.config.ConfigurationServiceprotected StringgetRequestMapping(String queryString) protected String[]protected Collection<LanguageModel>getStoresLanguages(BaseStoreModel currentBaseStore) 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.
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.protected booleanisNotBaseSiteResource(String requestMapping) protected StringparseBaseSiteId(String requestMapping) protected voidrecalculateCart(String currencyString) Recalculates cart when currency has changedvoidsetActivateBaseSiteInSessionStrategy(de.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy activateBaseSiteInSessionStrategy) voidsetBaseSiteResourceExceptions(Set<String> baseSiteResourceExceptions) voidsetBaseSiteService(de.hybris.platform.site.BaseSiteService baseSiteService) voidsetBaseStoreService(de.hybris.platform.store.services.BaseStoreService baseStoreService) voidsetCalculationService(de.hybris.platform.order.CalculationService calculationService) voidsetCartService(de.hybris.platform.order.CartService cartService) voidsetCommerceCommonI18NService(de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService commerceCommonI18NService) voidsetCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService) voidsetConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService) setCurrencyFromRequest(javax.servlet.http.HttpServletRequest request) Method set current currency based on information from request and recalculate cart for current sessionprotected voidsetCurrentBaseSite(BaseSiteModel baseSiteModel) setLanguageFromRequest(javax.servlet.http.HttpServletRequest request) Method set current language base on information from request
-
Constructor Details
-
DefaultTmaContextInformationLoader
public DefaultTmaContextInformationLoader()
-
-
Method Details
-
setLanguageFromRequest
public LanguageModel setLanguageFromRequest(javax.servlet.http.HttpServletRequest request) throws TmaUnsupportedLanguageException Description copied from interface:TmaContextInformationLoaderMethod set current language base on information from request- Specified by:
setLanguageFromRequestin interfaceTmaContextInformationLoader- Parameters:
request- - request from which we should get language information- Returns:
- language set as current
- Throws:
TmaUnsupportedLanguageException
-
getStoresLanguages
-
setCurrencyFromRequest
public CurrencyModel setCurrencyFromRequest(javax.servlet.http.HttpServletRequest request) throws TmaUnsupportedCurrencyException, TmaRecalculationException Description copied from interface:TmaContextInformationLoaderMethod set current currency based on information from request and recalculate cart for current session- Specified by:
setCurrencyFromRequestin interfaceTmaContextInformationLoader- Parameters:
request- - request from which we should get currency information- Returns:
- currency set as current
- Throws:
TmaUnsupportedCurrencyExceptionTmaRecalculationException
-
recalculateCart
Recalculates cart when currency has changed- Throws:
TmaRecalculationException
-
initializeSiteFromRequest
public BaseSiteModel initializeSiteFromRequest(javax.servlet.http.HttpServletRequest request) throws TmaInvalidResourceException 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 throwInvalidResourceExceptionif 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 interfaceTmaContextInformationLoader- Parameters:
request- - request from which we should get base site uid- Returns:
- baseSite set as current site or null
- Throws:
InvalidResourceExceptionTmaInvalidResourceException
-
getRequestMapping
-
isNotBaseSiteResource
-
parseBaseSiteId
-
getSpecialUrlCharacters
-
setCurrentBaseSite
-
getConfigurationService
public de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService() -
setConfigurationService
public void setConfigurationService(de.hybris.platform.servicelayer.config.ConfigurationService configurationService) -
getBaseSiteResourceExceptions
-
setBaseSiteResourceExceptions
-
getBaseSiteService
public de.hybris.platform.site.BaseSiteService getBaseSiteService() -
setBaseSiteService
public void setBaseSiteService(de.hybris.platform.site.BaseSiteService baseSiteService) -
getActivateBaseSiteInSessionStrategy
public de.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy getActivateBaseSiteInSessionStrategy() -
setActivateBaseSiteInSessionStrategy
public void setActivateBaseSiteInSessionStrategy(de.hybris.platform.basecommerce.strategies.ActivateBaseSiteInSessionStrategy activateBaseSiteInSessionStrategy) -
getCommonI18NService
public de.hybris.platform.servicelayer.i18n.CommonI18NService getCommonI18NService() -
setCommonI18NService
public void setCommonI18NService(de.hybris.platform.servicelayer.i18n.CommonI18NService commonI18NService) -
getCommerceCommonI18NService
public de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService getCommerceCommonI18NService() -
setCommerceCommonI18NService
public void setCommerceCommonI18NService(de.hybris.platform.commerceservices.i18n.CommerceCommonI18NService commerceCommonI18NService) -
getBaseStoreService
public de.hybris.platform.store.services.BaseStoreService getBaseStoreService() -
setBaseStoreService
public void setBaseStoreService(de.hybris.platform.store.services.BaseStoreService baseStoreService) -
getCartService
public de.hybris.platform.order.CartService getCartService() -
setCartService
public void setCartService(de.hybris.platform.order.CartService cartService) -
getCalculationService
public de.hybris.platform.order.CalculationService getCalculationService() -
setCalculationService
public void setCalculationService(de.hybris.platform.order.CalculationService calculationService)
-