Getting ServerName from Event Handler | Community
Skip to main content
December 6, 2024
Solved

Getting ServerName from Event Handler

  • December 6, 2024
  • 1 reply
  • 385 views

Hello,

 

I am working on Cloud AEM.

 

I am working on Event Handler to call our api on page replication.

For which I am using a ReplicationAction to know path and user details.

 

I have a requirement to know which is the server it is like prod/stage/dev/rde

AMS gives this info from this.slingSettingsService.getRunModes() 

Where as Cloud is not returning expected values.

 

In servlet, I can get server url like this req.getServerName()

But Since this is my Event Listener class, I am not getting way to get server details.

 

Can anyone guide on this how to get server name with event listener?

 

Regards

Kiran

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by narendiran_ravi

Hi @kiranko5 ,

You can create an OSGI config to set the environment type and set different values using environment variables.

Refer -https://blog.developer.adobe.com/custom-runmodes-on-aem-as-a-cloud-service-79b757f51a6b 

1 reply

narendiran_ravi
narendiran_raviAccepted solution
Level 6
December 6, 2024

Hi @kiranko5 ,

You can create an OSGI config to set the environment type and set different values using environment variables.

Refer -https://blog.developer.adobe.com/custom-runmodes-on-aem-as-a-cloud-service-79b757f51a6b