I started out with AEM in 2013. On my first project, I remember having to do something with CORS headers. I remember doing it with a "whiteboard filter". At that time didn't have a good grasp on OSGi and Sling. I don't remember if the Granite CORS filter was around either. All I knew is that this type of filter let me bypass that pesky authentication on the author. In retrospect, not a good idea!
I moved on to the next project, but I never forgot that "whiteboard" thing. Until recently when I was doing research for my last post. I had to disambiguate between The Whiteboard Pattern and the HTTP Whiteboard Specification. As implemented by Apache Felix.
Explore the HTTP Service Console
Open up your local instance at http://localhost:4502/system/console/httpservice. It follows the pattern of listing out servlets, filters and listeners, by context. Each of these services has a rank, ensuring it runs ahead of the others. For example, the 'default' context ranks last.
There is the Sling context named org.apache.sling with one servlet. The Sling Engine Main Servlet and Sling Engine Servlet Context Helper are also open-source. As an AEM developer, this is the context you live in.
I also see that every context has the I18NFilter enabled. This is open-source and as you can see, it wraps the request. I bring this up because this filter will behave slightly differently based on the type of request and response. And that depends on our context. More on that later.
Create a New Project
I am using the AEM Project Archetype v31 to get this set up. I am adding the following dependency so that I can use these property-type annotations.
Read Full Blog
Please use this thread to ask the related questions.