Added some common stuff for public and secure application handling from
ph-webapp-demo