You can set a service ranking on your filter to control the order of execution.
@Properties({ @Property(name = Constants.SERVICE_DESCRIPTION, value = "Description"),
@Property(name = Constants.SERVICE_VENDOR, value = "Vendor"),
@Property(name = Constants.SERVICE_RANKING, intValue = -760, propertyPrivate = true),
@Property(name = "filter.scope", value = "request", propertyPrivate = true)
})
You can see the service ranking of your existing filters by looking at the properties of the component e.g.
http://localhost:4502/system/console/components/org.apache.sling.i18n.impl.I18NFilter
It seems that if components have the same service ranking then their service.id will be used to determine their order.
You can see the order that the filers are being processed by looking at the recent requests
http://localhost:4502/system/console/requests
and picking the request you made. You'll see something like:
0 (2013-04-04 15:12:56) LOG Calling filter: org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter
0 (2013-04-04 15:12:56) LOG Calling filter: org.apache.sling.i18n.impl.I18NFilter
0 (2013-04-04 15:12:56) LOG Calling filter: org.apache.sling.rewriter.impl.RewriterFilter
0 (2013-04-04 15:12:56) LOG Calling filter: com.day.cq.wcm.core.impl.WCMRequestFilter
0 (2013-04-04 15:12:56) LOG Calling filter: com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet
2 (2013-04-04 15:12:56) LOG Calling filter: org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter
2 (2013-04-04 15:12:56) LOG Calling filter: com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter
Some older filters will use the filter.order
property. This is only used if the service.ranking property is not found. See SLING-1735.