FELIX-6500 : Apply filtering for post requests
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigAdminSupport.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigAdminSupport.java
index 337a42d..2840ce3 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigAdminSupport.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigAdminSupport.java
@@ -21,7 +21,6 @@
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
@@ -93,6 +92,20 @@
return null;
}
+ private Map<String, Object> getAllowedValues(final Configuration config, final Dictionary<String, Object> props) throws IOException {
+ final List<String> allowedProperties = this.getJsonSupport().getPropertyNamesForForm(config.getFactoryPid(), config.getPid(), props);
+ final Map<String, Object> allowedValues = new HashMap<>();
+ final Dictionary<String, Object> origProps = config.getProperties();
+ if ( origProps != null ) {
+ for(final String name : Collections.list(origProps.keys())) {
+ if ( !allowedProperties.contains(name) ) {
+ allowedValues.put(name, origProps.get(name));
+ }
+ }
+ }
+ return allowedValues;
+ }
+
/**
* Apply the update to the configuration
* @param request The request
@@ -113,16 +126,7 @@
props = new Hashtable<>();
}
// filter properties and keep filtered values
- final List<String> allowedProperties = this.getJsonSupport().getPropertyNamesForForm(config.getFactoryPid(), config.getPid(), props);
- final Map<String, Object> allowedValues = new HashMap<>();
- final Dictionary<String, Object> origProps = config.getProperties();
- if ( origProps != null ) {
- for(final String name : Collections.list(props.keys())) {
- if ( !allowedProperties.contains(name) ) {
- allowedValues.put(name, origProps.get(name));
- }
- }
- }
+ final Map<String, Object> allowedValues = getAllowedValues(config, props);
final MetaTypeServiceSupport mtss = getMetaTypeSupport();
final Map<String, MetatypePropertyDescriptor> adMap = ( mtss != null ) ? mtss.getAttributeDefinitionMap( config, null ) : new HashMap<>();