Expand my Community achievements bar.

Override DefaultGetServlet config

Avatar

Level 3

Hello Community,

We have a requirement to override some of the properties that are part of the "Apache Sling Get Servlet (org.apache.sling.servlets.get.DefaultGetServlet)". Since this is not a factory config, we don't need to specify "-<identifier>".

I have tried using the following configuration under the paths mentioned below. However, when checking the values in system/console/configMgr, it is not picking up the custom config.

/apps/project1/osgiconfig/config/org.apache.sling.servlets.get.DefaultGetServlet.cfg.json

/apps/project1/osgiconfig/config/org.apache.sling.servlets.get.DefaultGetServlet.config

Do I need to override the config under this path?

/apps/system/config/org.apache.sling.servlets.get.DefaultGetServlet.config

Please let me know if anyone has customized this config in your project. Thank you.

 

@Jörg_Hoh @EstebanBustamante @Vijayalakshmi_S 

 

6 Replies

Avatar

Community Advisor

@test1234567 

 

We should not check-in configs under /apps/system. These are created when we manually save values from OSGi console.

 

I guess OOTB there is no entry for "/apps/system/config/org.apache.sling.servlets.get.DefaultGetServlet.config".
Please cross-check and remove if it was created by you. 

 

After removing, please check if your project specific configs are available via /apps/project1/osgiconfig/config/org.apache.sling.servlets.get.DefaultGetServlet.cfg.json

 


Aanchal Sikka

Avatar

Level 3

Thanks for your reply. If it is lower environment, we can remove the entries from this path /apps/system/config/org.apache.sling.servlets.get.DefaultGetServlet.config but we may have the entries in Prod as well and we have some restrictions to remove the entries from /apps/system. How can we address this scenario?

Avatar

Level 3

Yes of course. The problem here is, even though I have kept the config under the below path. In some instances, I see it is still pointing to /apps/system/config/org.apache.sling.servlets.get.DefaultGetServlet.config not picking the config from the project folder. I have verified the OSGi-installer console and the status of the config from the project folder says "Install". and the one from the /apps/system/  says "INSTALLED".

 

I had to manually delete the config under /apps/system/config/ and edit the config in the web console and then only it pointed to the project folder but we don't have the liberty to make such manual changes in Prod instance.

 

 /apps/project1/osgiconfig/config/org.apache.sling.servlets.get.DefaultGetServlet.cfg.json

 

Avatar

Community Advisor

@test1234567 

 

We cannot override the preference order. I suggest taking a back-up of configs in production. Install project specific configs and then delete the one in /apps/system.

Perform this operation on one instance at a time and validate.


Aanchal Sikka

Avatar

Level 4

Hi @test1234567 ,

To override the configuration of the Apache Sling Get Servlet (org.apache.sling.servlets.get.DefaultGetServlet), you typically need to place your custom configuration under the /apps/system/config/ directory.

So, the correct path for your custom configuration file would be:

 

/apps/system/config/org.apache.sling.servlets.get.DefaultGetServlet.config

 

Ensure that the configuration file follows the correct format and includes the properties you want to override. Once you place the configuration file in the correct location, you should see the updated values reflected in the system console under the Configuration Manager (/system/console/configMgr).

If you're still not seeing the changes take effect after placing the configuration file in the correct location, make sure that the configuration properties are correctly defined and that there are no syntax errors in your configuration file. Additionally, you may need to restart Apache Sling or the entire AEM instance for the changes to take effect.

If you continue to encounter issues, you may want to check the Apache Sling documentation or seek assistance from the Apache Sling community for further troubleshooting.