Migrate Pat-REST related to leejo/rest

Reorganized several code to leejo/rest package.
Prepare for migration out.
Enhance REST with an additional protocol layer

Add an additional protocol interface to REST. Allow to switch encoder
with reference to session.