You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2017/03/24 14:51:22 UTC

svn commit: r1788461 - in /sling/trunk/bundles/engine: ./ src/main/java/org/apache/sling/engine/impl/ src/main/java/org/apache/sling/engine/impl/log/ src/main/java/org/apache/sling/engine/impl/parameters/ src/main/java/org/apache/sling/engine/impl/requ...

Author: cziegeler
Date: Fri Mar 24 14:51:22 2017
New Revision: 1788461

URL: http://svn.apache.org/viewvc?rev=1788461&view=rev
Log:
SLING-6706 : Migrate to R6 annotations, clean up dependencies

Removed:
    sling/trunk/bundles/engine/src/main/resources/
Modified:
    sling/trunk/bundles/engine/pom.xml
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingSettingsServiceImpl.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLogger.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLoggerService.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/parameters/RequestParameterSupportConfigurer.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java

Modified: sling/trunk/bundles/engine/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/pom.xml?rev=1788461&r1=1788460&r2=1788461&view=diff
==============================================================================
--- sling/trunk/bundles/engine/pom.xml (original)
+++ sling/trunk/bundles/engine/pom.xml Fri Mar 24 14:51:22 2017
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>29</version>
+        <version>30</version>
         <relativePath />
     </parent>
 
@@ -51,10 +51,6 @@
         <plugins>
             <plugin>
                 <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <extensions>true</extensions>
                 <configuration>
@@ -132,13 +128,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.mime</artifactId>
-            <version>2.0.2-incubator</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.osgi</artifactId>
-            <version>2.1.0</version>
+            <version>2.1.2</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -165,10 +155,6 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.scr.annotations</artifactId>
-        </dependency>
-        <dependency>
             <groupId>com.sun.japex</groupId>
             <artifactId>japex</artifactId>
             <version>1.2.3</version>

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java?rev=1788461&r1=1788460&r2=1788461&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java (original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingMainServlet.java Fri Mar 24 14:51:22 2017
@@ -34,23 +34,12 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.PropertyUnbounded;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.apache.felix.scr.annotations.ReferencePolicy;
-import org.apache.felix.scr.annotations.References;
 import org.apache.sling.api.adapter.AdapterManager;
 import org.apache.sling.api.request.SlingRequestEvent;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.servlets.ServletResolver;
 import org.apache.sling.auth.core.AuthenticationSupport;
 import org.apache.sling.commons.mime.MimeTypeService;
-import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.engine.SlingRequestProcessor;
 import org.apache.sling.engine.impl.filter.ServletFilterManager;
 import org.apache.sling.engine.impl.helper.ClientAbortException;
@@ -64,58 +53,84 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.framework.Version;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
 import org.osgi.service.http.context.ServletContextHelper;
 import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * The <code>SlingMainServlet</code> TODO
+ * The <code>SlingMainServlet</code>
  */
 @SuppressWarnings("serial")
-@Component(immediate = true, metatype = true, label = "%sling.name", description = "%sling.description")
-@Properties( {
-    @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software Foundation"),
-    @Property(name = Constants.SERVICE_DESCRIPTION, value = "Sling Servlet")
+@Component(property = {
+        Constants.SERVICE_VENDOR + "=The Apache Software Foundation",
+        Constants.SERVICE_DESCRIPTION + "=Sling Servlet"
 })
-@References( {
-    @Reference(name = "ErrorHandler", referenceInterface = ErrorHandler.class, cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = ReferencePolicy.DYNAMIC, bind = "setErrorHandler", unbind = "unsetErrorHandler"),
-    @Reference(name = "ServletResolver", referenceInterface = ServletResolver.class, cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = ReferencePolicy.DYNAMIC, bind = "setServletResolver", unbind = "unsetServletResolver"),
-    @Reference(name = "MimeTypeService", referenceInterface = MimeTypeService.class, cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = ReferencePolicy.DYNAMIC, bind = "setMimeTypeService", unbind = "unsetMimeTypeService"),
-    @Reference(name = "AuthenticationSupport", referenceInterface = AuthenticationSupport.class, cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = ReferencePolicy.DYNAMIC, bind = "setAuthenticationSupport", unbind = "unsetAuthenticationSupport") })
+@Designate(ocd=SlingMainServlet.Config.class)
 public class SlingMainServlet extends GenericServlet {
 
-    @Property(intValue=RequestData.DEFAULT_MAX_CALL_COUNTER)
-    public static final String PROP_MAX_CALL_COUNTER = "sling.max.calls";
-
-    @Property(intValue=RequestData.DEFAULT_MAX_INCLUSION_COUNTER)
-    public static final String PROP_MAX_INCLUSION_COUNTER = "sling.max.inclusions";
-
-    public static final boolean DEFAULT_ALLOW_TRACE = false;
-
-    @Property(boolValue=DEFAULT_ALLOW_TRACE)
-    public static final String PROP_ALLOW_TRACE = "sling.trace.allow";
-
-    @Property(intValue = RequestHistoryConsolePlugin.STORED_REQUESTS_COUNT)
-    private static final String PROP_MAX_RECORD_REQUESTS = "sling.max.record.requests";
-
-    @Property(unbounded=PropertyUnbounded.ARRAY)
-    private static final String PROP_TRACK_PATTERNS_REQUESTS = "sling.store.pattern.requests";
-
-    private static final String PROP_DEFAULT_PARAMETER_ENCODING = "sling.default.parameter.encoding";
-
-    @Property
-    private static final String PROP_SERVER_INFO = "sling.serverinfo";
-
+    @ObjectClassDefinition(name ="Apache Sling Main Servlet",
+            description="Main processor of the Sling framework controlling all " +
+                    "aspects of processing requests inside of Sling, namely authentication, " +
+                    "resource resolution, servlet/script resolution and execution of servlets " +
+                    "and scripts.")
+    public @interface Config {
+
+        @AttributeDefinition(name = "Number of Calls per Request",
+                description = "Defines the maximum number of Servlet and Script " +
+                     "calls while processing a single client request. This number should be high " +
+                     "enough to not limit request processing artificially. On the other hand it " +
+                     "should not be too high to allow the mechanism to limit the resources required " +
+                     "to process a request in case of errors. The default value is 1000.")
+        int sling_max_calls() default RequestData.DEFAULT_MAX_CALL_COUNTER;
+
+        @AttributeDefinition(name = "Recursion Depth",
+                description = "The maximum number of recursive Servlet and " +
+                     "Script calls while processing a single client request. This number should not " +
+                     "be too high, otherwise StackOverflowErrors may occurr in case of erroneous " +
+                     "scripts and servlets. The default value is 50. ")
+        int sling_max_inclusions() default RequestData.DEFAULT_MAX_INCLUSION_COUNTER;
+
+        @AttributeDefinition(name = "Allow the HTTP TRACE method",
+                description = "If set to true, the HTTP TRACE method will be " +
+                     "enabled. By default the HTTP TRACE methods is disabled as it can be used in " +
+                     "Cross Site Scripting attacks on HTTP servers.")
+        boolean sling_trace_allow() default false;
+
+        @AttributeDefinition(name = "Number of Requests to Record",
+                description = "Defines the number of requests that " +
+                     "internally recorded for display on the \"Recent Requests\" Web Console page. If " +
+                     "this value is less than or equal to zero, no requests are internally kept. The " +
+                     "default value is 20. ")
+        int sling_max_record_requests() default RequestHistoryConsolePlugin.STORED_REQUESTS_COUNT;
+
+        @AttributeDefinition(name = "Recorded Request Path Patterns",
+                description = "One or more regular expressions which " +
+                            "limit the requests which are stored by the \"Recent Requests\" Web Console page.")
+        String[] sling_store_pattern_requests();
+
+        @AttributeDefinition(name = "Server Info",
+                description = "The server info returned by Sling. If this field is left empty, Sling generates a default into.")
+        String sling_serverinfo();
+
+        @AttributeDefinition(name = "Additional response headers",
+                description = "Provides mappings for additional response headers "
+                    + "Each entry is of the form 'bundleId [ \":\" responseHeaderName ] \"=\" responseHeaderValue'")
+        String[] sling_additional_response_headers() default {"X-Content-Type-Options=nosniff", "X-Frame-Options=SAMEORIGIN"};
+    }
 
-    @Property(value = {"X-Content-Type-Options=nosniff", "X-Frame-Options=SAMEORIGIN"},
-            label = "Additional response headers",
-            description = "Provides mappings for additional response headers "
-                + "Each entry is of the form 'bundleId [ \":\" responseHeaderName ] \"=\" responseHeaderValue' ",
-            unbounded = PropertyUnbounded.ARRAY)
-    private static final String PROP_ADDITIONAL_RESPONSE_HEADERS = "sling.additional.response.headers";
+    private static final String DEPRECATED_ENCODING_PROPERTY = "sling.default.parameter.encoding";
 
-    @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY, policy = ReferencePolicy.DYNAMIC)
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC)
     private volatile AdapterManager adapterManager;
 
     /** default log */
@@ -162,7 +177,7 @@ public class SlingMainServlet extends Ge
 
     private RequestListenerManager requestListenerManager;
 
-    private boolean allowTrace = DEFAULT_ALLOW_TRACE;
+    private boolean allowTrace;
 
     private Object printerRegistration;
 
@@ -338,30 +353,31 @@ public class SlingMainServlet extends Ge
 
     @Activate
     protected void activate(final BundleContext bundleContext,
-            final Map<String, Object> componentConfig) {
+            final Map<String, Object> componentConfig,
+            final Config config) {
 
-        final String[] props = PropertiesUtil.toStringArray(componentConfig.get(PROP_ADDITIONAL_RESPONSE_HEADERS));
-
-        final ArrayList<StaticResponseHeader> mappings = new ArrayList<StaticResponseHeader>(props.length);
-        for (final String prop : props) {
-            if (prop != null && prop.trim().length() > 0 ) {
-                try {
-                    final StaticResponseHeader mapping = new StaticResponseHeader(prop.trim());
-                    mappings.add(mapping);
-                } catch (final IllegalArgumentException iae) {
-                    log.info("configure: Ignoring '{}': {}", prop, iae.getMessage());
+        final String[] props = config.sling_additional_response_headers();
+        if ( props != null ) {
+            final ArrayList<StaticResponseHeader> mappings = new ArrayList<>(props.length);
+            for (final String prop : props) {
+                if (prop != null && prop.trim().length() > 0 ) {
+                    try {
+                        final StaticResponseHeader mapping = new StaticResponseHeader(prop.trim());
+                        mappings.add(mapping);
+                    } catch (final IllegalArgumentException iae) {
+                        log.info("configure: Ignoring '{}': {}", prop, iae.getMessage());
+                    }
                 }
             }
+            RequestData.setAdditionalResponseHeaders(mappings);
         }
-        RequestData.setAdditionalResponseHeaders(mappings);
-
-        configuredServerInfo = PropertiesUtil.toString(componentConfig.get(PROP_SERVER_INFO), null);
+        configuredServerInfo = config.sling_serverinfo();
 
         // setup server info
         setProductInfo(bundleContext);
 
         // prepare the servlet configuration from the component config
-        final Hashtable<String, Object> configuration = new Hashtable<String, Object>(
+        final Hashtable<String, Object> configuration = new Hashtable<>(
             componentConfig);
 
         // ensure the servlet name
@@ -370,25 +386,19 @@ public class SlingMainServlet extends Ge
         }
 
         // configure method filter
-        allowTrace = PropertiesUtil.toBoolean(componentConfig.get(PROP_ALLOW_TRACE),
-                DEFAULT_ALLOW_TRACE);
+        allowTrace = config.sling_trace_allow();
 
         // configure the request limits
-        RequestData.setMaxIncludeCounter(PropertiesUtil.toInteger(
-            componentConfig.get(PROP_MAX_INCLUSION_COUNTER),
-            RequestData.DEFAULT_MAX_INCLUSION_COUNTER));
-        RequestData.setMaxCallCounter(PropertiesUtil.toInteger(
-            componentConfig.get(PROP_MAX_CALL_COUNTER),
-            RequestData.DEFAULT_MAX_CALL_COUNTER));
+        RequestData.setMaxIncludeCounter(config.sling_max_inclusions());
+        RequestData.setMaxCallCounter(config.sling_max_calls());
         RequestData.setSlingMainServlet(this);
 
         // Warn about the obsolete parameter encoding configuration
-        if (componentConfig.get(PROP_DEFAULT_PARAMETER_ENCODING) != null) {
+        if (componentConfig.get(DEPRECATED_ENCODING_PROPERTY) != null) {
             log.warn("Please configure the default request parameter encoding using "
                 + "the 'org.apache.sling.engine.parameters' configuration PID; the property "
-                + PROP_DEFAULT_PARAMETER_ENCODING
-                + "="
-                + componentConfig.get(PROP_DEFAULT_PARAMETER_ENCODING)
+                + DEPRECATED_ENCODING_PROPERTY + "="
+                + componentConfig.get(DEPRECATED_ENCODING_PROPERTY)
                 + " is obsolete and ignored");
         }
 
@@ -432,11 +442,10 @@ public class SlingMainServlet extends Ge
 
         // setup the request info recorder
         try {
-            int maxRequests = PropertiesUtil.toInteger(
-                componentConfig.get(PROP_MAX_RECORD_REQUESTS),
-                RequestHistoryConsolePlugin.STORED_REQUESTS_COUNT);
-            String[] patterns = PropertiesUtil.toStringArray(componentConfig.get(PROP_TRACK_PATTERNS_REQUESTS), new String[0]);
-            List<Pattern> compiledPatterns = new ArrayList<Pattern>(patterns.length);
+            int maxRequests = config.sling_max_record_requests();
+            String[] patterns = config.sling_store_pattern_requests();
+            if ( patterns == null ) patterns = new String[0];
+            List<Pattern> compiledPatterns = new ArrayList<>(patterns.length);
             for (String pattern : patterns) {
                 if(pattern != null && pattern.trim().length() > 0) {
                     compiledPatterns.add(Pattern.compile(pattern));
@@ -449,7 +458,7 @@ public class SlingMainServlet extends Ge
         }
 
         try {
-            Dictionary<String, String> mbeanProps = new Hashtable<String, String>();
+            Dictionary<String, String> mbeanProps = new Hashtable<>();
             mbeanProps.put("jmx.objectname", "org.apache.sling:type=engine,service=RequestProcessor");
 
             RequestProcessorMBeanImpl mbean = new RequestProcessorMBeanImpl();
@@ -460,7 +469,7 @@ public class SlingMainServlet extends Ge
         }
 
         // provide the SlingRequestProcessor service
-        Hashtable<String, String> srpProps = new Hashtable<String, String>();
+        Hashtable<String, String> srpProps = new Hashtable<>();
         srpProps.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
         srpProps.put(Constants.SERVICE_DESCRIPTION, "Sling Request Processor");
         requestProcessorRegistration = bundleContext.registerService(
@@ -536,6 +545,7 @@ public class SlingMainServlet extends Ge
         log.info(this.getServerInfo() + " shut down");
     }
 
+    @Reference(name = "ErrorHandler", cardinality=ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, unbind = "unsetErrorHandler")
     void setErrorHandler(final ErrorHandler errorHandler) {
         requestProcessor.setErrorHandler(errorHandler);
     }
@@ -544,6 +554,7 @@ public class SlingMainServlet extends Ge
         requestProcessor.unsetErrorHandler(errorHandler);
     }
 
+    @Reference(name = "ServletResolver", cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, unbind = "unsetServletResolver")
     public void setServletResolver(final ServletResolver servletResolver) {
         requestProcessor.setServletResolver(servletResolver);
     }
@@ -552,6 +563,7 @@ public class SlingMainServlet extends Ge
         requestProcessor.unsetServletResolver(servletResolver);
     }
 
+    @Reference(name = "MimeTypeService", cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, unbind = "unsetMimeTypeService")
     public void setMimeTypeService(final MimeTypeService mimeTypeService) {
         slingHttpContext.setMimeTypeService(mimeTypeService);
     }
@@ -560,6 +572,7 @@ public class SlingMainServlet extends Ge
         slingHttpContext.unsetMimeTypeService(mimeTypeService);
     }
 
+    @Reference(name = "AuthenticationSupport", cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, unbind = "unsetAuthenticationSupport")
     public void setAuthenticationSupport(
             final AuthenticationSupport authenticationSupport) {
         slingHttpContext.setAuthenticationSupport(authenticationSupport);
@@ -571,7 +584,7 @@ public class SlingMainServlet extends Ge
     }
 
     private Dictionary<String, String> toStringConfig(Dictionary<?, ?> config) {
-        Dictionary<String, String> stringConfig = new Hashtable<String, String>();
+        Dictionary<String, String> stringConfig = new Hashtable<>();
         for (Enumeration<?> ke = config.keys(); ke.hasMoreElements();) {
             Object key = ke.nextElement();
             stringConfig.put(key.toString(), String.valueOf(config.get(key)));

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingSettingsServiceImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingSettingsServiceImpl.java?rev=1788461&r1=1788460&r2=1788461&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingSettingsServiceImpl.java (original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingSettingsServiceImpl.java Fri Mar 24 14:51:22 2017
@@ -18,10 +18,9 @@
  */
 package org.apache.sling.engine.impl;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.engine.SlingSettingsService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
 
 /**
  * The implementation of the settings service has moved to the
@@ -29,8 +28,7 @@ import org.apache.sling.engine.SlingSett
  *
  * @deprecated
  */
-@Component
-@Service
+@Component(service = SlingSettingsService.class)
 @Deprecated
 public class SlingSettingsServiceImpl
     implements SlingSettingsService {
@@ -41,6 +39,7 @@ public class SlingSettingsServiceImpl
     /**
      * @see org.apache.sling.engine.SlingSettingsService#getSlingId()
      */
+    @Override
     public String getSlingId() {
         return this.settingsService.getSlingId();
     }

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLogger.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLogger.java?rev=1788461&r1=1788460&r2=1788461&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLogger.java (original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLogger.java Fri Mar 24 14:51:22 2017
@@ -18,55 +18,92 @@
  */
 package org.apache.sling.engine.impl.log;
 
+import java.lang.annotation.Annotation;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.PropertyOption;
-import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+import org.osgi.service.metatype.annotations.Option;
 
 /**
  * The <code>RequestLogger</code> just registers {@link RequestLoggerService}
  * instance on behalf of the provided configuration.
  */
-@Component(metatype = true, label = "%request.log.name", description = "%request.log.description")
-@Properties({
-    @Property(name = "service.description", value = "Request Logger"),
-    @Property(name = "service.vendor", value = "The Apache Software Foundation")
+@Component(property = {
+        "service.description=Request Logger",
+        "service.vendor=The Apache Software Foundation"
 })
+@Designate(ocd = RequestLogger.Config.class)
 public class RequestLogger {
 
-    @Property(value = "logs/request.log")
-    public static final String PROP_REQUEST_LOG_OUTPUT = "request.log.output";
-
-    @Property(intValue = 0, options = {
-        @PropertyOption(name = "0", value = "Logger Name"), @PropertyOption(name = "1", value = "File Name"),
-        @PropertyOption(name = "2", value = "RequestLog Service")
-    })
-    public static final String PROP_REQUEST_LOG_OUTPUT_TYPE = "request.log.outputtype";
-
-    @Property(boolValue = true)
-    public static final String PROP_REQUEST_LOG_ENABLED = "request.log.enabled";
-
-    @Property(value = "logs/access.log")
-    public static final String PROP_ACCESS_LOG_OUTPUT = "access.log.output";
-
-    @Property(intValue = 0, options = {
-        @PropertyOption(name = "0", value = "Logger Name"), @PropertyOption(name = "1", value = "File Name"),
-        @PropertyOption(name = "2", value = "RequestLog Service")
-    })
-    public static final String PROP_ACCESS_LOG_OUTPUT_TYPE = "access.log.outputtype";
-
-    @Property(boolValue = true)
-    public static final String PROP_ACCESS_LOG_ENABLED = "access.log.enabled";
+    @ObjectClassDefinition(name = "Apache Sling Request Logger",
+            description="Configures the main loggers of the request logger, " +
+                     "namely the request log and the access log. Further loggers may be configured " +
+                     "by creating configurations for the Request Logger Service.")
+    public @interface Config {
+
+        @AttributeDefinition(name = "Request Log Name",
+                description = "Name of the destination for the request log. "+
+                     "The request log logs the entry and exit of each request into and "+
+                     "out of the system together with the entry time, exit time, time to process "+
+                     "the request, a request counter as well as the final status code and response "+
+                     "content type. In terms of Request Logger Service formats, request entry is "+
+                     "logged with the format \"%t [%R] -> %m %U%q %H\" and request exit is logged "+
+                     "with the format \"%{end}t [%R] <- %s %{Content-Type}o %Dms\".")
+        String request_log_output() default "logs/request.log";
+
+        @AttributeDefinition(name = "Request Log Type",
+                description = "Type of request log destination. Select "+
+                     "\"Logger Name\" to write the access log to an SLF4J logger, \"File Name\" to "+
+                     "write the access log to a file (relative paths resolved against sling.home) "+
+                     "or \"RequestLog Service\" to use a named OSGi service registered with the "+
+                     "service interface \"org.apache.sling.engine.RequestLog\" and a service property "+
+                     "\"requestlog.name\" equal to the Logger Name setting.",
+                options = {
+                    @Option(label = "Logger Name", value = "0"),
+                    @Option(label = "File Name", value = "1"),
+                    @Option(label = "RequestLog Service", value = "2")
+        })
+        int request_log_outputtype() default 0;
+
+        @AttributeDefinition(name = "Enable Request Log",
+                description = "Whether to enable Request logging or not.")
+        boolean request_log_enabled() default true;
+
+        @AttributeDefinition(name = "Access Log Name",
+                description = "Name of the destination for the request log. "+
+                     "The access log writes an entry for each request as the request terminates "+
+                     "using the NCSA extended/combined log format. In terms of Request Logger "+
+                     "Service formats the access log is written with the format "+
+                     "\"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"\".")
+        String access_log_output() default "logs/access.log";
+
+        @AttributeDefinition(name = "Access Log Type",
+                description = "Type of access log destination. Select "+
+                     "\"Logger Name\" to write the access log to an SLF4J logger, \"File Name\" to "+
+                     "write the access log to a file (relative paths resolved against sling.home) "+
+                     "or \"RequestLog Service\" to use a named OSGi service registered with the "+
+                     "service interface \"org.apache.sling.engine.RequestLog\" and a service property "+
+                     "\"requestlog.name\" equal to the Logger Name setting.",
+                options = {
+                    @Option(label = "Logger Name", value = "0"),
+                    @Option(label = "File Name", value = "1"),
+                    @Option(label = "RequestLog Service", value = "2")
+        })
+        int access_log_outputtype() default 0;
+
+        @AttributeDefinition(name = "Enable Access Log",
+                description = "Whether to enable Access logging or not.")
+        boolean access_log_enabled() default true;
+    }
 
     /**
      * The log format string for the request log entry message (value is "%t
@@ -91,30 +128,24 @@ public class RequestLogger {
      * RequestLoggerService instances created on behalf of the static
      * configuration.
      */
-    private Map<ServiceRegistration, RequestLoggerService> services = new HashMap<ServiceRegistration, RequestLoggerService>();
+    private Map<ServiceRegistration, RequestLoggerService> services = new HashMap<>();
 
     // ---------- SCR Integration ----------------------------------------------
 
     @Activate
-    protected void activate(BundleContext bundleContext, Map<String, Object> props) {
+    protected void activate(BundleContext bundleContext, Config config) {
 
         // prepare the request loggers if a name is configured and the
         // request loggers are enabled
-        final String requestLogName = PropertiesUtil.toString(props.get(PROP_REQUEST_LOG_OUTPUT), null);
-        final boolean requestLogEnabled = PropertiesUtil.toBoolean(props.get(PROP_REQUEST_LOG_ENABLED), false);
-        if (requestLogName != null && requestLogEnabled) {
-            final int requestLogType = PropertiesUtil.toInteger(props.get(PROP_REQUEST_LOG_OUTPUT_TYPE), 0);
-            createRequestLoggerService(services, bundleContext, true, REQUEST_LOG_ENTRY_FORMAT, requestLogName, requestLogType);
-            createRequestLoggerService(services, bundleContext, false, REQUEST_LOG_EXIT_FORMAT, requestLogName, requestLogType);
+        if (config.request_log_output() != null && config.request_log_enabled()) {
+            createRequestLoggerService(services, bundleContext, true, REQUEST_LOG_ENTRY_FORMAT, config.request_log_output(), config.request_log_outputtype());
+            createRequestLoggerService(services, bundleContext, false, REQUEST_LOG_EXIT_FORMAT, config.request_log_output(), config.request_log_outputtype());
         }
 
         // prepare the access logger if a name is configured and the
         // access logger is enabled
-        final String accessLogName = PropertiesUtil.toString(props.get(PROP_ACCESS_LOG_OUTPUT), null);
-        final boolean accessLogEnabled = PropertiesUtil.toBoolean(props.get(PROP_ACCESS_LOG_ENABLED), false);
-        if (accessLogName != null && accessLogEnabled) {
-            final int accessLogType = PropertiesUtil.toInteger(props.get(PROP_ACCESS_LOG_OUTPUT_TYPE), 0);
-            createRequestLoggerService(services, bundleContext, false, ACCESS_LOG_FORMAT, accessLogName, accessLogType);
+        if (config.access_log_output() != null && config.access_log_enabled()) {
+            createRequestLoggerService(services, bundleContext, false, ACCESS_LOG_FORMAT, config.access_log_output(), config.access_log_outputtype());
         }
     }
 
@@ -127,15 +158,40 @@ public class RequestLogger {
         services.clear();
     }
 
-    private static void createRequestLoggerService(Map<ServiceRegistration, RequestLoggerService> services, BundleContext bundleContext, boolean onEntry, Object format, String output, Object outputType) {
-        final Hashtable<String, Object> config = new Hashtable<String, Object>();
-        config.put(RequestLoggerService.PARAM_ON_ENTRY, onEntry ? Boolean.TRUE : Boolean.FALSE);
-        config.put(RequestLoggerService.PARAM_FORMAT, format);
-        config.put(RequestLoggerService.PARAM_OUTPUT, output);
-        config.put(RequestLoggerService.PARAM_OUTPUT_TYPE, outputType);
-
-        final RequestLoggerService service = new RequestLoggerService(bundleContext, config);
-        final ServiceRegistration reg = bundleContext.registerService(service.getClass().getName(), service, config);
+    private static void createRequestLoggerService(Map<ServiceRegistration, RequestLoggerService> services,
+            final BundleContext bundleContext,
+            final boolean onEntry,
+            final String format,
+            final String output,
+            final int outputType) {
+        final RequestLoggerService service = new RequestLoggerService(bundleContext, new RequestLoggerService.Config() {
+
+            @Override
+            public Class<? extends Annotation> annotationType() {
+                return  RequestLoggerService.Config.class;
+            }
+
+            @Override
+            public int request_log_service_outputtype() {
+                return outputType;
+            }
+
+            @Override
+            public String request_log_service_output() {
+                return output;
+            }
+
+            @Override
+            public boolean request_log_service_onentry() {
+                return onEntry;
+            }
+
+            @Override
+            public String request_log_service_format() {
+                return format;
+            }
+        });
+        final ServiceRegistration reg = bundleContext.registerService(service.getClass().getName(), service, null);
         services.put(reg, service);
     }
 }

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLoggerService.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLoggerService.java?rev=1788461&r1=1788460&r2=1788461&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLoggerService.java (original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/log/RequestLoggerService.java Fri Mar 24 14:51:22 2017
@@ -20,51 +20,71 @@ package org.apache.sling.engine.impl.log
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Map;
 
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.ConfigurationPolicy;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.PropertyOption;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.engine.RequestLog;
 import org.osgi.framework.BundleContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+import org.osgi.service.metatype.annotations.Option;
 
 /**
  * The <code>RequestLoggerService</code> is a factory component which gets
  * configuration to register loggers for the {@link RequestLogger}.
  */
-@Component(
-        metatype = true,
-        label = "%request.log.service.name",
-        description = "%request.log.service.description",
-        configurationFactory = true,
-        policy = ConfigurationPolicy.REQUIRE)
-@Properties({
-    @Property(name = "service.description", value = "Factory for configuration based request/access loggers"),
-    @Property(name = "service.vendor", value = "The Apache Software Foundation")
-})
-@Service(value = RequestLoggerService.class)
+@Component(service = RequestLoggerService.class, configurationPolicy = ConfigurationPolicy.REQUIRE,
+     property = {
+             "service.description=Factory for configuration based request/access loggers",
+             "service.vendor=The Apache Software Foundation"
+     })
+@Designate(ocd = RequestLoggerService.Config.class, factory = true)
 public class RequestLoggerService {
 
-    @Property
-    public static final String PARAM_FORMAT = "request.log.service.format";
-
-    @Property(value = "request.log")
-    public static final String PARAM_OUTPUT = "request.log.service.output";
-
-    @Property(intValue = 0, options = {
-        @PropertyOption(name = "0", value = "Logger Name"), @PropertyOption(name = "1", value = "File Name"),
-        @PropertyOption(name = "2", value = "RequestLog Service")
-    })
-    public static final String PARAM_OUTPUT_TYPE = "request.log.service.outputtype";
+    @ObjectClassDefinition(name = "Apache Sling Customizable Request Data Logger",
+            description="This configuration creates customizable "+
+                 "loggers for request content. Each configuration results in a logger writing "+
+                 "the requested data. Deleting an existing configuration removes the respective "+
+                 "logger.")
+    public @interface Config {
+
+        @AttributeDefinition(name = "Log Format",
+                description="The format for log entries. This is "+
+                    "a format string as defined at http://sling.apache.org/site/client-request-logging.html#ClientRequestLogging-LogFormatSpecification.")
+        String request_log_service_format();
+
+        @AttributeDefinition(name = "Logger Name",
+                description="Name of the destination for the log "+
+                     "output. Depending on the output type this is a file name (absolute or "+
+                     "relative), a SLF4J logger name or the name under which a RequestLog service "+
+                     "has been registered.")
+        String request_log_service_output() default "reuest.log";
+
+        @AttributeDefinition(name = "Logger Type",
+                description = "Type of log destination. Select "+
+                     "\"Logger Name\" to write the access log to an SLF4J logger, \"File Name\" to "+
+                     "write the access log to a file (relative paths resolved against sling.home) "+
+                     "or \"RequestLog Service\" to use a named OSGi service registered with the "+
+                     "service interface \"org.apache.sling.engine.RequestLog\" and a service property "+
+                     "\"requestlog.name\" equal to the Logger Name setting.",
+                options = {
+                    @Option(label = "Logger Name", value = "0"),
+                    @Option(label = "File Name", value = "1"),
+                    @Option(label = "RequestLog Service", value = "2")
+        })
+        int request_log_service_outputtype() default 0;
+
+        @AttributeDefinition(name = "Request Entry",
+                description="Check if the logger is called on "+
+                     "request entry. Otherwise leave unchecked and the logger will be called on "+
+                     "request exit (aka termination), which is the default for access logger type "+
+                     "loggers.")
+        boolean request_log_service_onentry() default false;
+    }
 
-    @Property(boolValue = false)
-    public static final String PARAM_ON_ENTRY = "request.log.service.onentry";
 
     private static final int OUTPUT_TYPE_LOGGER = 0;
 
@@ -84,26 +104,25 @@ public class RequestLoggerService {
     public RequestLoggerService() {
     }
 
-    RequestLoggerService(BundleContext bundleContext, Map<String, Object> configuration) {
+    RequestLoggerService(BundleContext bundleContext, Config configuration) {
         this.setup(bundleContext, configuration);
     }
 
     @Activate
-    void setup(BundleContext bundleContext, Map<String, Object> configuration) {
+    void setup(BundleContext bundleContext, Config configuration) {
         // whether to log on request entry or request exit
-        this.onEntry = PropertiesUtil.toBoolean(configuration.get(PARAM_ON_ENTRY), false);
+        this.onEntry = configuration.request_log_service_onentry();
 
         // shared or private CustomLogFormat
-        final String format = PropertiesUtil.toString(configuration.get(PARAM_FORMAT), null);
+        final String format = configuration.request_log_service_format();
         if (format != null) {
             this.logFormat = new CustomLogFormat(format);
         }
 
         // where to log to
-        final String output = PropertiesUtil.toString(configuration.get(PARAM_OUTPUT), null);
+        final String output = configuration.request_log_service_output();
         if (output != null) {
-            final int outputType = PropertiesUtil.toInteger(configuration.get(PARAM_OUTPUT_TYPE), OUTPUT_TYPE_LOGGER);
-            this.log = this.getLog(bundleContext, output, outputType);
+            this.log = this.getLog(bundleContext, output, configuration.request_log_service_outputtype());
         }
     }
 

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/parameters/RequestParameterSupportConfigurer.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/parameters/RequestParameterSupportConfigurer.java?rev=1788461&r1=1788460&r2=1788461&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/parameters/RequestParameterSupportConfigurer.java (original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/parameters/RequestParameterSupportConfigurer.java Fri Mar 24 14:51:22 2017
@@ -19,99 +19,89 @@
 package org.apache.sling.engine.impl.parameters;
 
 import java.io.File;
-import java.util.Dictionary;
 
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.settings.SlingSettingsService;
-import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @Component(
-        metatype = true,
-        name = RequestParameterSupportConfigurer.PID,
-        label = "Apache Sling Request Parameter Handling",
-        description = "Configures Sling's request parameter handling.")
+        name = RequestParameterSupportConfigurer.PID)
+@Designate(ocd=RequestParameterSupportConfigurer.Config.class)
 public class RequestParameterSupportConfigurer {
 
+    @ObjectClassDefinition(name = "Apache Sling Request Parameter Handling",
+        description = "Configures Sling's request parameter handling.")
+    public @interface Config {
+        @AttributeDefinition(
+                name = "Default Parameter Encoding",
+                description = "The default request parameter encoding used to decode request "
+                    + "parameters into strings. If this property is not set the default encoding "
+                    + "is 'ISO-8859-1' as mandated by the Servlet API spec. This default encoding "
+                    + "is used if the '_charset_' request parameter is not set to another "
+                    + "(supported) character encoding. Applications being sure to always use the "
+                    + "same encoding (e.g. UTF-8) can set this default here and may omit the "
+                    + "'_charset_' request parameter")
+        String sling_default_parameter_encoding() default Util.ENCODING_DIRECT;
+
+        @AttributeDefinition(
+                name = "Maximum POST Parameters",
+                description = "The maximum number of parameters supported. To prevent a DOS-style attack with an "
+                    + "overrunning number of parameters the number of parameters supported can be limited. This "
+                    + "includes all of the query string as well as application/x-www-form-urlencoded and "
+                    + "multipart/form-data parameters. The default value is " + ParameterMap.DEFAULT_MAX_PARAMS + ".")
+       int sling_default_max_parameters() default ParameterMap.DEFAULT_MAX_PARAMS;
+
+        @AttributeDefinition(
+                name = "Temporary File Location",
+                description = "The temporary directory where uploaded files are written to disk. The default is "
+                    + "null, which means the directory given by the 'java.io.tmpdir' system property.")
+        String file_location();
+
+        @AttributeDefinition(
+                name = "File Save Threshold",
+                description = "The size threshold after which the file will be written to disk. The default is 256KB.")
+        int file_threshold() default 256000;
+
+        @AttributeDefinition(
+                name = "Maximum File Size",
+                description = "The maximum size allowed for uploaded files. The default is -1, which means unlimited.")
+        long file_max() default -1;
+
+        @AttributeDefinition(
+                name = "Maximum Request Size",
+                description = "The maximum size allowed for multipart/form-data requests. The default is -1, which means unlimited.")
+        long request_max() default -1;
+
+        @AttributeDefinition(
+                name = "Check Additional Parameters",
+                description = "Enable this if you want to include request parameters added through the container, e.g through a valve.")
+        boolean sling_default_parameter_checkForAdditionalContainerParameters() default false;
+    }
     static final String PID = "org.apache.sling.engine.parameters";
 
     /** default log */
     private final Logger log = LoggerFactory.getLogger(PID);
 
-    @Property(
-            value = Util.ENCODING_DIRECT,
-            label = "Default Parameter Encoding",
-            description = "The default request parameter encoding used to decode request "
-                + "parameters into strings. If this property is not set the default encoding "
-                + "is 'ISO-8859-1' as mandated by the Servlet API spec. This default encoding "
-                + "is used if the '_charset_' request parameter is not set to another "
-                + "(supported) character encoding. Applications being sure to always use the "
-                + "same encoding (e.g. UTF-8) can set this default here and may omit the "
-                + "'_charset_' request parameter")
-    private static final String PROP_FIX_ENCODING = "sling.default.parameter.encoding";
-
-    @Property(
-            intValue = ParameterMap.DEFAULT_MAX_PARAMS,
-            label = "Maximum POST Parameters",
-            description = "The maximum number of parameters supported. To prevent a DOS-style attack with an "
-                + "overrunning number of parameters the number of parameters supported can be limited. This "
-                + "includes all of the query string as well as application/x-www-form-urlencoded and "
-                + "multipart/form-data parameters. The default value is " + ParameterMap.DEFAULT_MAX_PARAMS + ".")
-    private static final String PROP_MAX_PARAMS = "sling.default.max.parameters";
-
-    @Property(
-            label = "Temporary File Location",
-            description = "The size threshold after which the file will be written to disk. The default is "
-                + "null, which means the directory given by the 'java.io.tmpdir' system property.")
-    private static final String PROP_FILE_LOCATION = "file.location";
-
-    @Property(
-            longValue = 256000,
-            label = "File Save Threshold",
-            description = "The size threshold after which the file will be written to disk. The default is 256KB.")
-    private static final String PROP_FILE_SIZE_THRESHOLD = "file.threshold";
-
-    @Property(
-            longValue = -1,
-            label = "Maximum File Size",
-            description = "The maximum size allowed for uploaded files. The default is -1, which means unlimited.")
-    private static final String PROP_FILE_SIZE_MAX = "file.max";
-
-    @Property(
-            longValue = -1,
-            label = "Maximum Request Size",
-            description = "The maximum size allowed for multipart/form-data requests. The default is -1, which means unlimited.")
-    private static final String PROP_MAX_REQUEST_SIZE = "request.max";
-
-    @Property(
-            boolValue = false,
-            label = "Check Additional Parameters",
-            description = "Enable this if you want to include request parameters added through the container, e.g through a valve.")
-    private static final String PROP_CHECK_ADDITIONAL_PARAMETERS = "sling.default.parameter.checkForAdditionalContainerParameters";
+
 
     @Reference
     private SlingSettingsService settignsService;
 
     @Activate
-    @Deactivate
-    private void configure(ComponentContext context) {
-        @SuppressWarnings("unchecked")
-        Dictionary<String, Object> props = context.getProperties();
-
-        final String fixEncoding = PropertiesUtil.toString(props.get(PROP_FIX_ENCODING), Util.ENCODING_DIRECT);
-        final int maxParams = PropertiesUtil.toInteger(props.get(PROP_MAX_PARAMS), ParameterMap.DEFAULT_MAX_PARAMS);
-        final long maxRequestSize = PropertiesUtil.toLong(props.get(PROP_MAX_REQUEST_SIZE), -1);
-        final String fileLocation = getFileLocation(context,
-            PropertiesUtil.toString(props.get(PROP_FILE_LOCATION), null));
-        final long maxFileSize = PropertiesUtil.toLong(props.get(PROP_FILE_SIZE_MAX), -1);
-        final int fileSizeThreshold = PropertiesUtil.toInteger(props.get(PROP_FILE_SIZE_THRESHOLD), -1);
-        final boolean checkAddParameters = PropertiesUtil.toBoolean(props.get(PROP_CHECK_ADDITIONAL_PARAMETERS), false);
+    private void configure(final Config config) {
+        final String fixEncoding = config.sling_default_parameter_encoding();
+        final int maxParams = config.sling_default_max_parameters();
+        final long maxRequestSize = config.request_max();
+        final String fileLocation = getFileLocation(config.file_location());
+        final long maxFileSize = config.file_max();
+        final int fileSizeThreshold = config.file_threshold();
+        final boolean checkAddParameters = config.sling_default_parameter_checkForAdditionalContainerParameters();
 
         if (log.isInfoEnabled()) {
             log.info("Default Character Encoding: {}", fixEncoding);
@@ -129,7 +119,7 @@ public class RequestParameterSupportConf
                 fileSizeThreshold, checkAddParameters);
     }
 
-    private String getFileLocation(final ComponentContext context, String fileLocation) {
+    private String getFileLocation(String fileLocation) {
         if (fileLocation != null) {
             File file = new File(fileLocation);
             if (!file.isAbsolute()) {

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java?rev=1788461&r1=1788460&r2=1788461&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java (original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java Fri Mar 24 14:51:22 2017
@@ -115,7 +115,7 @@ public class RequestData {
     /**
      * The name of the request attribute to override the max call number (-1 for infinite or integer value).
      */
-    private static String REQUEST_MAX_CALL_OVERRIDE = SlingMainServlet.PROP_MAX_CALL_COUNTER;
+    private static String REQUEST_MAX_CALL_OVERRIDE = "sling.max.calls";
 
     private static SlingMainServlet SLING_MAIN_SERVLET;
 
@@ -218,7 +218,7 @@ public class RequestData {
 
         // Getting the RequestProgressTracker from the request attributes like
         // this should not be generally used, it's just a way to pass it from
-        // its creation point to here, so it's made available via 
+        // its creation point to here, so it's made available via
         // the Sling request's getRequestProgressTracker method.
         final Object o = request.getAttribute(RequestProgressTracker.class.getName());
         if(o instanceof SlingRequestProgressTracker) {