2
votes

I wrote an interceptor in one of my projects to intercept all the requests. So usually in a spring project i will do normal build and start the server and my changes related to an interceptor will start reflecting. However this doesn't seem to be the case with a hybris project. Do I need to do update in hybris hac as well? And if I do then out of the available below mentioned options which options do i need to choose and why. 1. Update running system 2. Clear the hMC configuration from the database 3. Create essential data 4. Localize types

Thanks, Ashish

3

3 Answers

3
votes

To answer the second part of your question, I have listed at least one reason for selecting each type of options. Hope this helps.

  1. Update running system - Required when hybris type definition changes. For example, changing the content of file <extnesion-name>-items.xml
  2. Clear the hMC configuration from the database - If you have chosen to persist hmc configuration in the Database and changing it. For example, changing content in the file hmc.xml
  3. Create essential data - If there is a change in the content in the impex files which follows the naming pattern of essentialdata*.impex.
  4. Localize types - If there is a change in the properties files for localizations. for example changing the content in file <extension-name>-locales_en.properties
1
votes

Assuming you've not made any changes to any underlying data objects (Jalo items) then you won't need to run an update in the hybris hAC.

You should just be able to make your changes, run ant clean all from the platform and then start up the hybris ECP instance and your changes will be visible.

0
votes

If this is a normal Spring MVC interceptor, then it should work fine. Have you checked your spring configuration in the storefront extension you are working from?

For example, take a look at the accelerator Spring MVC configuration file:

hybris/bin/ext-template/yacceleratorstorefront/web/webroot/WEB-INF/config/spring-mvc-config.xml

This has some examples where this is used out-of-the-box:

<mvc:interceptors>
    <ref bean="beforeControllerHandlerInterceptor" />
    <ref bean="beforeViewHandlerInterceptor" />
    <ref bean="csrfHandlerInterceptor" />
</mvc:interceptors>

As an example, the default before controller handler interceptor is defined as:

<!-- Interceptor that runs once per request and before the controller handler method is called -->
    <alias name="defaultBeforeControllerHandlerInterceptor" alias="beforeControllerHandlerInterceptor" />
    <bean id="defaultBeforeControllerHandlerInterceptor" class="de.hybris.platform.yacceleratorstorefront.interceptors.BeforeControllerHandlerInterceptor" >
        <property name="beforeControllerHandlers">
            <ref bean="beforeControllerHandlersList" /> 
        </property>
    </bean>

which references:

<alias name="defaultBeforeControllerHandlersList" alias="beforeControllerHandlersList" />
<util:list id="defaultBeforeControllerHandlersList" >
    <!-- List of handlers to run -->
    <bean class="de.hybris.platform.yacceleratorstorefront.interceptors.beforecontroller.SecurityUserCheckBeforeControllerHandler" />
    <bean class="de.hybris.platform.yacceleratorstorefront.interceptors.beforecontroller.RequireHardLoginBeforeControllerHandler" >
            <property name="userService" ref="userService"/>
            <property name="redirectStrategy" ref="redirectStrategy"/>
       ...

    </bean>
    <bean class="de.hybris.platform.yacceleratorstorefront.interceptors.beforecontroller.DeviceDetectionBeforeControllerHandler" />

...

</util:list>

So you could either override this using the alias with your own implementation, or add additional controller handlers to the list.

As there is no change to the underlying data model - this is just wiring up Spring MVC related classes - no need for an update system or anything like that. Just an 'ant clean all' to recompile to pick up your new interceptor classes, and server restart to pick up the change in the Spring cornfiguraton.