// SlingHttpServletRequest instance factory
private static SlingHttpServletRequestFactory getSlingHttpServletRequestFactory() {
SlingHttpServletRequestFactory factory = RequestData.REQUEST_FACTORY;
if (factory == null) {
SlingMainServlet servlet = RequestData.SLING_MAIN_SERVLET;
if (servlet == null || servlet.getServletContext() == null
|| servlet.getServletContext().getMajorVersion() < 3) {
factory = new SlingHttpServletRequestFactory() {
public SlingHttpServletRequest createRequest(RequestData requestData, HttpServletRequest request) {
return new SlingHttpServletRequestImpl(requestData, request);
}