Refactor Request to use get* and set* methods to access state.

If we are ever going to move to a statically typed or compiled version of php then the methods need to have clearer input/return types.
Some db refactoring.