DWR infrastructure fixes

These commits fix some issues we encountered downstream with DWR. Bugs fixed here are quite hard to encounter in Spacewalk since there is less AJAX use, nevertheless those might still happen. In addition to that, these commits will ease future AJAX work and/or upstreaming of new features.