In my case, the problem was that I implemented a custom Filter (see here, here and here) and the custom HttpServletRequestWrapper
needs to take care of the H2 console login request which comes with the form data (including Driver Class input) and parse it as parameters:
public class MyHttpServletRequestWrapper extends HttpServletRequestWrapper {
private String body;
public MyHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
this.body = IOUtils.toString(request.getReader());
//...
}
@Override
public Enumeration<String> getParameterNames() {
if (!parsedParams)
parseParams();
List<String> result = Collections.list(super.getParameterNames());
result.addAll(parameters.keySet());
return Collections.enumeration(result);
}
private void parseParams() {
if (!body.isEmpty()) {
String[] rps = body.split("&");
for (String rp : rps) {
String[] kv = rp.split("=");
try {
parameters.put(kv[0], kv.length > 1 ? new String[]{URLDecoder.decode(kv[1], "UTF-8")} : new String[]{""});
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
parameters.setLocked(true);
parsedParams = true;
}
}
@Override
public Map<String, String[]> getParameterMap() {
if (!parsedParams)
parseParams();
Map<String, String[]> s = super.getParameterMap();
return Stream.concat(parameters.entrySet().stream(), s.entrySet().stream()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
@Override
public String getParameter(String name) {
return parameters.get(name) != null ? parameters.get(name)[0] : super.getParameter(name);
}
@Override
public String[] getParameterValues(String name) {
String[] s = super.getParameterValues(name);
return ArrayUtils.addAll(s, parameters.get(name));
}
}