Created
May 25, 2017 20:54
-
-
Save nateyolles/c3d29da6a9dcb36d3648c40c8f7909b2 to your computer and use it in GitHub Desktop.
Sample OSGi servlet in AEM
This file contains hidden or 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
@Component( | |
immediate = true, | |
service = Servlet.class, | |
property = { | |
"sling.servlet.resourceTypes=project/components/component" | |
} | |
) | |
@Designate(ocd = SampleOsgiServlet.Configuration.class) | |
public class SampleOsgiServlet extends SlingSafeMethodsServlet { | |
@Activate | |
protected void Activate(Configuration config) { | |
boolean enabled = config.servletname_enabled(); | |
} | |
@ObjectClassDefinition(name="OSGi Annotation Demo Servlet") | |
public @interface Configuration { | |
@AttributeDefinition( | |
name = "Enable", | |
description = "Enable the servlet" | |
) | |
boolean servletname_enabled() default false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment