Minor refactor
Fix #1646 "xf:load with javascript: scheme doesn't work on page load"

- move XFormsToXHTML to Scala
- complete move of XHTMLHeadHandler to Scala
- sanitize some Java code
- redirect upon load only if there is at least one non-JavaScript load
- run JavaScript loads upon load