Issues with custom URLRewrite rules in 7.9
up vote
3
down vote
favorite
Currently I'm having some issues with custom URL rewrite rules within ISH 7.9.
For some of our environments it works fine (like local and test), but on ACC and PROD it only seems to work from time to time after multiple deploys/restarts of the system.
We have created a custom cartridge that has a deploy.gradle file to exclude the files urlrewriterules.xml, domainsplittings.xml and syndication-targets.properties from the original cartridges. They get replaced by our custom files in the share/system/config/cluster folder. The static rules applied in the urlrewriterules.xml always work fine. However the rules that are coming from custom Java classes sometimes don't get well loaded by the RewriteRuleFactoryImpl returning back the below error:
[2018-11-07 08:20:37.906 +0100] WARN localhost ES1 appserver0 [ShipSupport-ebusiness-Site] [-] com.intershop.component.urlrewrite.internal.factory.RewriteRuleFactoryImpl [Storefront] [wJ5DCcg2CM5DCZPUUqdNu2D2fj8NZHaXjvP9qIZb] [yFAAAFvikjkOsqjA-0-00] "yFAAAFvikjkOsqjA-0-00" An implementation of rewrite rule type 'CustomCategory' does not exist.
The part of code in the urlrewriterules.xml that will call this java class is the following:
<!-- Custom Category Rule /c/<NAME_OF_LOWEST_CATEGORY> -->
<rule type="CustomCategory" priority="1000" name="custom category rule">
<configurations>
<configuration id="pathPrefix">/catalog</configuration>
<configuration id="partsCatalogID">4393</configuration>
</configurations>
</rule>
We also have the classes well created in our own cartridge such as CustomCategoryRewriteRule that extends BaseRewriteRule. URL Rewrite is enabled for those channels and we always Invalidate the cache in the channels that have it enabled.
The extension for the CustomCategory (defined in the same cartridge) is defined as below:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
</extensionpoint:ExtensionPointModel>Also the app-extension.component is defined in the same cartridge as below:
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
</components>We followed this article to confirm on how to do it: https://support.intershop.com/kb/index.php/Display/B28069 We also have it working fine in another project, but using Intershop 7.8.
Do you have any idea on what might be the cause?
Thank you!
intershop
add a comment |
up vote
3
down vote
favorite
Currently I'm having some issues with custom URL rewrite rules within ISH 7.9.
For some of our environments it works fine (like local and test), but on ACC and PROD it only seems to work from time to time after multiple deploys/restarts of the system.
We have created a custom cartridge that has a deploy.gradle file to exclude the files urlrewriterules.xml, domainsplittings.xml and syndication-targets.properties from the original cartridges. They get replaced by our custom files in the share/system/config/cluster folder. The static rules applied in the urlrewriterules.xml always work fine. However the rules that are coming from custom Java classes sometimes don't get well loaded by the RewriteRuleFactoryImpl returning back the below error:
[2018-11-07 08:20:37.906 +0100] WARN localhost ES1 appserver0 [ShipSupport-ebusiness-Site] [-] com.intershop.component.urlrewrite.internal.factory.RewriteRuleFactoryImpl [Storefront] [wJ5DCcg2CM5DCZPUUqdNu2D2fj8NZHaXjvP9qIZb] [yFAAAFvikjkOsqjA-0-00] "yFAAAFvikjkOsqjA-0-00" An implementation of rewrite rule type 'CustomCategory' does not exist.
The part of code in the urlrewriterules.xml that will call this java class is the following:
<!-- Custom Category Rule /c/<NAME_OF_LOWEST_CATEGORY> -->
<rule type="CustomCategory" priority="1000" name="custom category rule">
<configurations>
<configuration id="pathPrefix">/catalog</configuration>
<configuration id="partsCatalogID">4393</configuration>
</configurations>
</rule>
We also have the classes well created in our own cartridge such as CustomCategoryRewriteRule that extends BaseRewriteRule. URL Rewrite is enabled for those channels and we always Invalidate the cache in the channels that have it enabled.
The extension for the CustomCategory (defined in the same cartridge) is defined as below:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
</extensionpoint:ExtensionPointModel>Also the app-extension.component is defined in the same cartridge as below:
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
</components>We followed this article to confirm on how to do it: https://support.intershop.com/kb/index.php/Display/B28069 We also have it working fine in another project, but using Intershop 7.8.
Do you have any idea on what might be the cause?
Thank you!
intershop
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Currently I'm having some issues with custom URL rewrite rules within ISH 7.9.
For some of our environments it works fine (like local and test), but on ACC and PROD it only seems to work from time to time after multiple deploys/restarts of the system.
We have created a custom cartridge that has a deploy.gradle file to exclude the files urlrewriterules.xml, domainsplittings.xml and syndication-targets.properties from the original cartridges. They get replaced by our custom files in the share/system/config/cluster folder. The static rules applied in the urlrewriterules.xml always work fine. However the rules that are coming from custom Java classes sometimes don't get well loaded by the RewriteRuleFactoryImpl returning back the below error:
[2018-11-07 08:20:37.906 +0100] WARN localhost ES1 appserver0 [ShipSupport-ebusiness-Site] [-] com.intershop.component.urlrewrite.internal.factory.RewriteRuleFactoryImpl [Storefront] [wJ5DCcg2CM5DCZPUUqdNu2D2fj8NZHaXjvP9qIZb] [yFAAAFvikjkOsqjA-0-00] "yFAAAFvikjkOsqjA-0-00" An implementation of rewrite rule type 'CustomCategory' does not exist.
The part of code in the urlrewriterules.xml that will call this java class is the following:
<!-- Custom Category Rule /c/<NAME_OF_LOWEST_CATEGORY> -->
<rule type="CustomCategory" priority="1000" name="custom category rule">
<configurations>
<configuration id="pathPrefix">/catalog</configuration>
<configuration id="partsCatalogID">4393</configuration>
</configurations>
</rule>
We also have the classes well created in our own cartridge such as CustomCategoryRewriteRule that extends BaseRewriteRule. URL Rewrite is enabled for those channels and we always Invalidate the cache in the channels that have it enabled.
The extension for the CustomCategory (defined in the same cartridge) is defined as below:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
</extensionpoint:ExtensionPointModel>Also the app-extension.component is defined in the same cartridge as below:
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
</components>We followed this article to confirm on how to do it: https://support.intershop.com/kb/index.php/Display/B28069 We also have it working fine in another project, but using Intershop 7.8.
Do you have any idea on what might be the cause?
Thank you!
intershop
Currently I'm having some issues with custom URL rewrite rules within ISH 7.9.
For some of our environments it works fine (like local and test), but on ACC and PROD it only seems to work from time to time after multiple deploys/restarts of the system.
We have created a custom cartridge that has a deploy.gradle file to exclude the files urlrewriterules.xml, domainsplittings.xml and syndication-targets.properties from the original cartridges. They get replaced by our custom files in the share/system/config/cluster folder. The static rules applied in the urlrewriterules.xml always work fine. However the rules that are coming from custom Java classes sometimes don't get well loaded by the RewriteRuleFactoryImpl returning back the below error:
[2018-11-07 08:20:37.906 +0100] WARN localhost ES1 appserver0 [ShipSupport-ebusiness-Site] [-] com.intershop.component.urlrewrite.internal.factory.RewriteRuleFactoryImpl [Storefront] [wJ5DCcg2CM5DCZPUUqdNu2D2fj8NZHaXjvP9qIZb] [yFAAAFvikjkOsqjA-0-00] "yFAAAFvikjkOsqjA-0-00" An implementation of rewrite rule type 'CustomCategory' does not exist.
The part of code in the urlrewriterules.xml that will call this java class is the following:
<!-- Custom Category Rule /c/<NAME_OF_LOWEST_CATEGORY> -->
<rule type="CustomCategory" priority="1000" name="custom category rule">
<configurations>
<configuration id="pathPrefix">/catalog</configuration>
<configuration id="partsCatalogID">4393</configuration>
</configurations>
</rule>
We also have the classes well created in our own cartridge such as CustomCategoryRewriteRule that extends BaseRewriteRule. URL Rewrite is enabled for those channels and we always Invalidate the cache in the channels that have it enabled.
The extension for the CustomCategory (defined in the same cartridge) is defined as below:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
</extensionpoint:ExtensionPointModel>Also the app-extension.component is defined in the same cartridge as below:
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
</components>We followed this article to confirm on how to do it: https://support.intershop.com/kb/index.php/Display/B28069 We also have it working fine in another project, but using Intershop 7.8.
Do you have any idea on what might be the cause?
Thank you!
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
</extensionpoint:ExtensionPointModel><?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomCategoryRewriteRule">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule" priority="1"/>
</extensionpoint:ExtensionPointModel><?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
</components><?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="cartridge_name" of="intershop.EnterpriseBackoffice.Cartridges"/>
</components>intershop
intershop
edited Nov 7 at 9:50
asked Nov 7 at 7:46
Duarte Pimenta
486
486
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
</extensionpoint:ExtensionPointModel>
Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:
<?xml version="1.0" encoding="UTF-8" ?>
<components xmlns="http://www.intershop.de/component/2010">
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
</components>
I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.
New contributor
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Updated my original post with extra information
– Duarte Pimenta
Nov 7 at 9:42
We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
– Bas de Groot
Nov 7 at 9:51
1
It seems this is an issue with the implementation of theRewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
– Andreas Paschwitz
Nov 7 at 13:16
1
I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applicationsSLDSystemandEnterpriseBackofficeonly (just like in your example). After starting the application server, I first opened a storefront page (application typeB2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
– Andreas Paschwitz
Nov 7 at 13:16
1
Adding the storefront application types seems to have fixed our issue indeed. Thanks!
– Bas de Groot
Nov 7 at 13:54
|
show 1 more comment
up vote
3
down vote
We ended up solving it out by apply the SMBResponsive cartridge as well.
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
</components>Thanks Andreas for all the help.
New contributor
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
</extensionpoint:ExtensionPointModel>
Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:
<?xml version="1.0" encoding="UTF-8" ?>
<components xmlns="http://www.intershop.de/component/2010">
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
</components>
I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.
New contributor
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Updated my original post with extra information
– Duarte Pimenta
Nov 7 at 9:42
We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
– Bas de Groot
Nov 7 at 9:51
1
It seems this is an issue with the implementation of theRewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
– Andreas Paschwitz
Nov 7 at 13:16
1
I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applicationsSLDSystemandEnterpriseBackofficeonly (just like in your example). After starting the application server, I first opened a storefront page (application typeB2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
– Andreas Paschwitz
Nov 7 at 13:16
1
Adding the storefront application types seems to have fixed our issue indeed. Thanks!
– Bas de Groot
Nov 7 at 13:54
|
show 1 more comment
up vote
2
down vote
accepted
Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
</extensionpoint:ExtensionPointModel>
Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:
<?xml version="1.0" encoding="UTF-8" ?>
<components xmlns="http://www.intershop.de/component/2010">
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
</components>
I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.
New contributor
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Updated my original post with extra information
– Duarte Pimenta
Nov 7 at 9:42
We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
– Bas de Groot
Nov 7 at 9:51
1
It seems this is an issue with the implementation of theRewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
– Andreas Paschwitz
Nov 7 at 13:16
1
I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applicationsSLDSystemandEnterpriseBackofficeonly (just like in your example). After starting the application server, I first opened a storefront page (application typeB2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
– Andreas Paschwitz
Nov 7 at 13:16
1
Adding the storefront application types seems to have fixed our issue indeed. Thanks!
– Bas de Groot
Nov 7 at 13:54
|
show 1 more comment
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
</extensionpoint:ExtensionPointModel>
Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:
<?xml version="1.0" encoding="UTF-8" ?>
<components xmlns="http://www.intershop.de/component/2010">
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
</components>
I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.
New contributor
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Besides the implementation, you also need to create an extension file in <cartridge>/staticfiles/cartridge/extensions. This is the actual registration of the rewrite rule for the lookup mechanism. See the following example:
<?xml version="1.0" encoding="UTF-8"?>
<extensionpoint:ExtensionPointModel xmlns:extensionpoint="http://www.intershop.de/extensionpoint/2011" name="CustomRewriteRule.extension">
<extensionBindings type="java" extensionPoint="com.intershop.component.urlrewrite.capi.RewriteRule-RewriteRule.create" extension="com.package.CustomCategoryRewriteRule " priority="1"/>
</extensionpoint:ExtensionPointModel>
Also the cartridge that contains these extensions needs to be registered at the application types via a component file in <cartridge>/staticfiles/cartridge/components. This is needed so that the extension is loaded correctly in the correct application context. See this example:
<?xml version="1.0" encoding="UTF-8" ?>
<components xmlns="http://www.intershop.de/component/2010">
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.SLDSystem.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CBackoffice.Cartridges" />
<fulfill requirement="selectedCartridge" value="your_custom_cartridge" of="intershop.B2CResponsive.Cartridges" />
</components>
I'm not quite sure if you need to register it for all of these applications, but these are the ones we used in our last project. If you use different application types or have custom ones, make sure to add those accordingly.
New contributor
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered Nov 7 at 9:26
Andreas Paschwitz
693
693
New contributor
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Andreas Paschwitz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Updated my original post with extra information
– Duarte Pimenta
Nov 7 at 9:42
We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
– Bas de Groot
Nov 7 at 9:51
1
It seems this is an issue with the implementation of theRewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
– Andreas Paschwitz
Nov 7 at 13:16
1
I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applicationsSLDSystemandEnterpriseBackofficeonly (just like in your example). After starting the application server, I first opened a storefront page (application typeB2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
– Andreas Paschwitz
Nov 7 at 13:16
1
Adding the storefront application types seems to have fixed our issue indeed. Thanks!
– Bas de Groot
Nov 7 at 13:54
|
show 1 more comment
1
Updated my original post with extra information
– Duarte Pimenta
Nov 7 at 9:42
We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
– Bas de Groot
Nov 7 at 9:51
1
It seems this is an issue with the implementation of theRewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.
– Andreas Paschwitz
Nov 7 at 13:16
1
I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applicationsSLDSystemandEnterpriseBackofficeonly (just like in your example). After starting the application server, I first opened a storefront page (application typeB2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.
– Andreas Paschwitz
Nov 7 at 13:16
1
Adding the storefront application types seems to have fixed our issue indeed. Thanks!
– Bas de Groot
Nov 7 at 13:54
1
1
Updated my original post with extra information
– Duarte Pimenta
Nov 7 at 9:42
Updated my original post with extra information
– Duarte Pimenta
Nov 7 at 9:42
We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
– Bas de Groot
Nov 7 at 9:51
We do have all these configurations in place, otherwise it would not work in any environment. The problem we have is that, for certain environments, it only works from 'time to time' after a certain amount of rebuilds/deploys.
– Bas de Groot
Nov 7 at 9:51
1
1
It seems this is an issue with the implementation of the
RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.– Andreas Paschwitz
Nov 7 at 13:16
It seems this is an issue with the implementation of the
RewriteRuleFactoryImpl: This factory is registered as singleton and the rules are loaded lazily only once and then cached. However, for loading the rules only the current application at the time of the lookup is considered. If this is an application which does not contain the cartridge, then it may be missing and will never get loaded. /edit: As a workaround, you may try to register the cartridge for more application types (especially the storefront ones) and see if the issue still persists.– Andreas Paschwitz
Nov 7 at 13:16
1
1
I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications
SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.– Andreas Paschwitz
Nov 7 at 13:16
I just managed to reproduce the issue locally by registering a cartridge (with some custom rewrite rules) for the applications
SLDSystem and EnterpriseBackoffice only (just like in your example). After starting the application server, I first opened a storefront page (application type B2CResponsive). The rewrite rules don't get loaded in this case and the URLs will never be re-written. However, if I open the backoffice first after server start, then the rules will get loaded and everything is working fine.– Andreas Paschwitz
Nov 7 at 13:16
1
1
Adding the storefront application types seems to have fixed our issue indeed. Thanks!
– Bas de Groot
Nov 7 at 13:54
Adding the storefront application types seems to have fixed our issue indeed. Thanks!
– Bas de Groot
Nov 7 at 13:54
|
show 1 more comment
up vote
3
down vote
We ended up solving it out by apply the SMBResponsive cartridge as well.
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
</components>Thanks Andreas for all the help.
New contributor
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
3
down vote
We ended up solving it out by apply the SMBResponsive cartridge as well.
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
</components>Thanks Andreas for all the help.
New contributor
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
3
down vote
up vote
3
down vote
We ended up solving it out by apply the SMBResponsive cartridge as well.
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
</components>Thanks Andreas for all the help.
New contributor
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
We ended up solving it out by apply the SMBResponsive cartridge as well.
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
</components>Thanks Andreas for all the help.
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
</components><?xml version="1.0" encoding="UTF-8"?>
<components xmlns="http://www.intershop.de/component/2010" scope="global">
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SLDSystem.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.EnterpriseBackoffice.Cartridges"/>
<fulfill requirement="selectedCartridge" value="royalihc_sldsystem" of="intershop.SMBResponsive.Cartridges" />
</components>New contributor
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered Nov 7 at 14:07
Duarte Pimenta
486
486
New contributor
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Duarte Pimenta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53185307%2fissues-with-custom-urlrewrite-rules-in-7-9%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password