ConstrainedProperty[] params = mapping.getConstraints();
Set<String> requiredParams = new HashSet<String>();
int optionalIndex = -1;
for (int j = 0; j < params.length; j++) {
ConstrainedProperty param = params[j];
if (!param.isNullable()) {
requiredParams.add(param.getPropertyName());
}
else {
optionalIndex = j;
break;
}
}
UrlMappingKey key = new UrlMappingKey(controllerName, actionName, namespace, pluginName,httpMethod, version,requiredParams);
mappingsLookup.put(key, mapping);
UrlMappingsListKey listKey = new UrlMappingsListKey(controllerName, actionName, namespace, pluginName,httpMethod, version);
mappingsListLookup.put(listKey, key);
if (LOG.isDebugEnabled()) {
LOG.debug("Reverse mapping: " + key + " -> " + mapping);
}
Set<String> requiredParamsAndOptionals = new HashSet<String>(requiredParams);
if (optionalIndex > -1) {
for (int j = optionalIndex; j < params.length; j++) {
ConstrainedProperty param = params[j];
requiredParamsAndOptionals.add(param.getPropertyName());
key = new UrlMappingKey(controllerName, actionName, namespace, pluginName,httpMethod, version,new HashSet<String>(requiredParamsAndOptionals));
mappingsLookup.put(key, mapping);
listKey = new UrlMappingsListKey(controllerName, actionName, namespace, pluginName,httpMethod, version);
mappingsListLookup.put(listKey, key);