Modify request.js to use ScriptableRequest directly.

The logic for the functionality was separated into a JavaScript and
Scala files. In this case, if we wanted to change the logic, we would
have to change both of them. This patch merged the logic in the
JavaScript file into the Scala one. Basically, this has the same purpose
with the previous ScriptableResponse patch.