Skip to content

Commit

Permalink
Following up with Nuno's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aaime committed Aug 9, 2018
1 parent a35ab9e commit b3f4c5f
Showing 1 changed file with 17 additions and 11 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -70,24 +70,26 @@ public final class MultiDimensionalExtension extends WMTSExtensionImpl {
/** Configuration key for the maximum allowed value of expand_limit */ /** Configuration key for the maximum allowed value of expand_limit */
public static final String EXPAND_LIMIT_MAX_KEY = "MD_DOMAIN_EXPAND_LIMIT_MAX"; public static final String EXPAND_LIMIT_MAX_KEY = "MD_DOMAIN_EXPAND_LIMIT_MAX";


public static final String LIMIT_MAX_KEY = "MD_GET_DOMAIN_VALUES_LIMIT_MAX"; public static final String DOMAIN_VALUES_LIMIT_MAX_KEY = "MD_GET_DOMAIN_VALUES_LIMIT_MAX";
/** Default value for the maximum allowed value of expand_limit, if not configured */ /** Default value for the maximum allowed value of expand_limit, if not configured */
private static final int EXPAND_LIMIT_MAX_DEFAULT = private static final int EXPAND_LIMIT_MAX_DEFAULT =
Integer.getInteger(EXPAND_LIMIT_MAX_KEY, 100000); Integer.getInteger(EXPAND_LIMIT_MAX_KEY, 100000);
/** Default value for the maximum allowed value of expand_limit, if not configured */ /** Default value for the maximum allowed value of expand_limit, if not configured */
private static final int LIMIT_MAX_DEFAULT = Integer.getInteger(LIMIT_MAX_KEY, 100000); private static final int DOMAIN_VALUES_LIMIT_MAX_DEFAULT =
Integer.getInteger(DOMAIN_VALUES_LIMIT_MAX_KEY, 100000);


/** Configuration key for expand_limit, if none is provided */ /** Configuration key for expand_limit, if none is provided */
public static final String EXPAND_LIMIT_KEY = "MD_DOMAIN_EXPAND_LIMIT"; public static final String EXPAND_LIMIT_KEY = "MD_DOMAIN_EXPAND_LIMIT";


public static final String LIMIT_KEY = "MD_GET_DOMAIN_VALUES_LIMIT"; public static final String DOMAIN_VALUES_LIMIT_KEY = "MD_GET_DOMAIN_VALUES_LIMIT";
/** Default value for the maximum allowed value of expand_limit, if not configured */ /** Default value for the maximum allowed value of expand_limit, if not configured */
private static final int EXPAND_LIMIT_DEFAULT = Integer.getInteger(EXPAND_LIMIT_KEY, 1000); private static final int EXPAND_LIMIT_DEFAULT = Integer.getInteger(EXPAND_LIMIT_KEY, 1000);


private static final int LIMIT_DEFAULT = Integer.getInteger(LIMIT_KEY, 1000); private static final int DOMAIN_VALUES_LIMIT_DEFAULT =
Integer.getInteger(DOMAIN_VALUES_LIMIT_KEY, 1000);


public static final String EXPAND_LIMIT = "expandLimit"; public static final String EXPAND_LIMIT = "expandLimit";
public static final String LIMIT = "limit"; public static final String DOMAIN_VALUES_LIMIT = "limit";


private final FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(); private final FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory();
private final GeoServer geoServer; private final GeoServer geoServer;
Expand Down Expand Up @@ -268,7 +270,11 @@ private Domains getDomainValues(SimpleConveyor conveyor) throws Exception {
} }


// get the limit, if any // get the limit, if any
int limit = getLimit(resource, conveyor.getParameter(LIMIT, false), conveyor.getResponse()); int limit =
getLimit(
resource,
conveyor.getParameter(DOMAIN_VALUES_LIMIT, false),
conveyor.getResponse());


// encode the domains // encode the domains
return new Domains(dimensions, layerInfo, null, SimplifyingFilterVisitor.simplify(filter)) return new Domains(dimensions, layerInfo, null, SimplifyingFilterVisitor.simplify(filter))
Expand Down Expand Up @@ -425,15 +431,15 @@ private int getLimit(ResourceInfo resource, Object clientLimit, HttpServletRespo
throw new OWSException( throw new OWSException(
400, 400,
"InvalidParameterValue", "InvalidParameterValue",
LIMIT, DOMAIN_VALUES_LIMIT,
"Invalid " "Invalid "
+ LIMIT + DOMAIN_VALUES_LIMIT
+ " " + " "
+ "value " + "value "
+ clientLimit + clientLimit
+ ", expected an integer value"); + ", expected an integer value");
} }
int limitMax = LIMIT_MAX_DEFAULT; int limitMax = DOMAIN_VALUES_LIMIT_MAX_DEFAULT;
if (value < limitMax) { if (value < limitMax) {
return value; return value;
} else { } else {
Expand All @@ -452,9 +458,9 @@ private int getLimit(ResourceInfo resource, Object clientLimit, HttpServletRespo
LOGGER.log( LOGGER.log(
Level.FINE, Level.FINE,
"Client did not provide a limit, using the internal default value: " "Client did not provide a limit, using the internal default value: "
+ LIMIT_DEFAULT); + DOMAIN_VALUES_LIMIT_DEFAULT);
} }
return LIMIT_DEFAULT; return DOMAIN_VALUES_LIMIT_DEFAULT;
} }
} }


Expand Down

0 comments on commit b3f4c5f

Please sign in to comment.