package at.gv.egiz.eaaf.modules.pvp2.impl.utils;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
public class SamlHttpUtils {
/**
* Always read the last parameter with this name from request to get a strict
* deterministic behavior.
*
* If more than one parameters with the same name exists, this method
* always select the last parameter value.
*
* @param request Incoming http request
* @param paramName Name of the http parameter
* @return the last parameter value with this name, or null
if the
* parameter not exists
*/
@Nullable
public static String getLastParameterFromRequest(@Nonnull HttpServletRequest request,
@Nonnull String paramName) {
final String[] values = request.getParameterValues(paramName);
if (values != null && values.length > 0) {
return values[values.length - 1];
}
return null;
}
}