Class DefaultContextInformationLoader

java.lang.Object
de.hybris.platform.ycommercewebservices.context.impl.DefaultContextInformationLoader
All Implemented Interfaces:
ContextInformationLoader

public class DefaultContextInformationLoader extends Object implements ContextInformationLoader
Default context information loader
  • Constructor Details

    • DefaultContextInformationLoader

      public DefaultContextInformationLoader()
  • Method Details

    • setLanguageFromRequest

      public LanguageModel setLanguageFromRequest(javax.servlet.http.HttpServletRequest request) throws UnsupportedLanguageException
      Description copied from interface: ContextInformationLoader
      Method set current language base on information from request
      Specified by:
      setLanguageFromRequest in interface ContextInformationLoader
      Parameters:
      request - - request from which we should get language information
      Returns:
      language set as current
      Throws:
      UnsupportedLanguageException
    • getStoresLanguages

      protected Collection<LanguageModel> getStoresLanguages(BaseStoreModel currentBaseStore)
    • setCurrencyFromRequest

      public CurrencyModel setCurrencyFromRequest(javax.servlet.http.HttpServletRequest request) throws UnsupportedCurrencyException, RecalculationException
      Description copied from interface: ContextInformationLoader
      Method set current currency based on information from request and recalculate cart for current session
      Specified by:
      setCurrencyFromRequest in interface ContextInformationLoader
      Parameters:
      request - - request from which we should get currency information
      Returns:
      currency set as current
      Throws:
      UnsupportedCurrencyException
      RecalculationException
    • recalculateCart

      protected void recalculateCart(String currencyString) throws RecalculationException
      Recalculates cart when currency has changed
      Throws:
      RecalculationException
    • initializeSiteFromRequest

      public BaseSiteModel initializeSiteFromRequest(javax.servlet.http.HttpServletRequest request) throws InvalidResourceException
      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 InvalidResourceException if 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:
      initializeSiteFromRequest in interface ContextInformationLoader
      Parameters:
      request - - request from which we should get base site uid
      Returns:
      baseSite set as current site or null
      Throws:
      InvalidResourceException
    • getRequestMapping

      protected String getRequestMapping(String queryString)
    • isNotBaseSiteResource

      protected boolean isNotBaseSiteResource(String requestMapping)
    • parseBaseSiteId

      protected String parseBaseSiteId(String requestMapping)
    • getSpecialUrlCharacters

      protected String[] getSpecialUrlCharacters()
    • setCurrentBaseSite

      protected void setCurrentBaseSite(BaseSiteModel baseSiteModel)
    • getConfigurationService

      public ConfigurationService getConfigurationService()
    • setConfigurationService

      public void setConfigurationService(ConfigurationService configurationService)
    • getBaseSiteResourceExceptions

      public Set<String> getBaseSiteResourceExceptions()
    • setBaseSiteResourceExceptions

      public void setBaseSiteResourceExceptions(Set<String> baseSiteResourceExceptions)
    • getBaseSiteService

      public BaseSiteService getBaseSiteService()
    • setBaseSiteService

      public void setBaseSiteService(BaseSiteService baseSiteService)
    • getActivateBaseSiteInSessionStrategy

      public ActivateBaseSiteInSessionStrategy getActivateBaseSiteInSessionStrategy()
    • setActivateBaseSiteInSessionStrategy

      public void setActivateBaseSiteInSessionStrategy(ActivateBaseSiteInSessionStrategy activateBaseSiteInSessionStrategy)
    • getCommonI18NService

      public CommonI18NService getCommonI18NService()
    • setCommonI18NService

      public void setCommonI18NService(CommonI18NService commonI18NService)
    • getCommerceCommonI18NService

      public CommerceCommonI18NService getCommerceCommonI18NService()
    • setCommerceCommonI18NService

      public void setCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService)
    • getBaseStoreService

      public BaseStoreService getBaseStoreService()
    • setBaseStoreService

      public void setBaseStoreService(BaseStoreService baseStoreService)
    • getCartService

      public CartService getCartService()
    • setCartService

      public void setCartService(CartService cartService)
    • getCalculationService

      public CalculationService getCalculationService()
    • setCalculationService

      public void setCalculationService(CalculationService calculationService)