Created
September 19, 2020 19:02
-
-
Save aanchalsikka/dd0bfd893eaf4492ef3453b7b723d45a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.techrevel.dam.core.servlets; | |
import java.io.IOException; | |
import java.util.Dictionary; | |
import javax.servlet.Servlet; | |
import org.apache.sling.api.SlingHttpServletRequest; | |
import org.apache.sling.api.SlingHttpServletResponse; | |
import org.apache.sling.api.servlets.HttpConstants; | |
import org.apache.sling.api.servlets.SlingAllMethodsServlet; | |
import org.apache.sling.commons.osgi.PropertiesUtil; | |
import org.osgi.service.cm.Configuration; | |
import org.osgi.service.cm.ConfigurationAdmin; | |
import org.osgi.service.component.annotations.Component; | |
import org.osgi.service.component.annotations.Reference; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
@Component(service = Servlet.class, property = { "sling.servlet.methods=" + HttpConstants.METHOD_GET, | |
"sling.servlet.paths=" + "/apps/techrevel/accessserviceconfig" }) | |
public class AccessServiceConfig extends SlingAllMethodsServlet { | |
private final Logger LOGGER = LoggerFactory.getLogger(getClass()); | |
@Reference | |
private ConfigurationAdmin configAdmin; | |
/** | |
* The method fetches the Post Process Observation configuration | |
* | |
* @throws IOException | |
*/ | |
private void getConfigs() throws IOException { | |
Configuration taxonomyFeedConfig = configAdmin | |
.getConfiguration("com.day.cq.commons.servlets.RootMappingServlet"); | |
Dictionary<String, Object> properties = taxonomyFeedConfig.getProperties(); | |
LOGGER.debug("[getConfigs] - Root Mapping Target: {}", | |
PropertiesUtil.toString(properties.get("rootmapping.target"), "")); | |
} | |
@Override | |
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException { | |
getConfigs(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment