I don't know how Google Blogger & Google Apps & Google App Engine allows us to add our own custom domain.
How such a functionality is implemented ?

How can it be implemented in our own java based web application ?

Say I want to setup a blog application which is hosted on myapp.com but it will allow to end user setup somesite.com.