check author or publish instance from java

Avatar

Avatar

kiranc13433869

Avatar

kiranc13433869

kiranc13433869

21-09-2020

Hi,

 

I am currently using AEM 6.5

My requirement is to check whether instance is author or publish instance.

As I have to disable one functionality on front end html.

i dont want to know from WCM MODE.

 

can anyone help me with appropriate solution.

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Nupur_Jain

MVP

Avatar

Nupur_Jain

MVP

Nupur_Jain
MVP

21-09-2020

Hi @kiranc13433869 

 

You can use SlingSettingService to check author or publish mode. Check this sample java code if it helps:

import com.day.cq.commons.Externalizer;

// If using in sling model
    @Inject
    SlingSettingsService slingSettingsService;

private boolean isAuthorRunMode() {
    Set<String> runModes = slingSettingsService.getRunModes();
    return runModes.contains(Externalizer.AUTHOR);
}

 

Hope it helps!

Thanks!

Nupur

Answers (1)

Answers (1)

Avatar

Avatar

vanegi

Employee

Avatar

vanegi

Employee

vanegi
Employee

21-09-2020

You can check the runmodes from http://localhost:6530/system/console/status-slingsettings

or

directly from tools->operation->system overview

 

Capture.JPG