com.clouway.oauth2.util.Params Maven / Gradle / Ivy
package com.clouway.oauth2.util;
import com.clouway.friendlyserve.Request;
import com.clouway.friendlyserve.RequestExt;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author Mihail Lesikov ([email protected])
*/
public class Params {
public Map parse(Request request, String... exclusions) {
RequestExt req = (RequestExt) request;
List exclusionsList = Arrays.asList(exclusions);
Map params = Maps.newHashMap();
for (String key : req.params().keySet()) {
String value = request.param(key) == null ? "" : request.param(key);
if (!Strings.isNullOrEmpty(value) && !exclusionsList.contains(key)) {
params.put(key, value);
}
}
return params;
}
}