[ejabberd] AtomPub interface

Badlop badlop at gmail.com
Mon Jun 23 15:27:45 MSD 2008

On Mon, Jun 23, 2008 at 11:15 AM, Eric Cestari <eric at ohmforce.com> wrote:
> On a related matter I'd need guidance for this :
> -define(BASEURL(Domain, User, Collection), "http://localhost:5280/
> atom/"++Domain++"/"++ User ++ "/"++Collection).
> I have that in my code, and that's ugly. Is there anyway to either :
> 1- find the DNS name of the http server
> 2- give additional configuration parameters to the http handler
> Maybe default to the first XMPP domain served by ejabberd
> And optionally be able to override this default information with this
> implementation :
> {5280, ejabberd_http, [
>                         http_poll,
>                         web_admin,
>                         {request_handlers, [{["atom"], atom_pubsub, [{baseurl, "http://www.ejabberd.ru
> "}]}]}
>                        ]}
> Of should I rather make atom_pubsub a module, configure it in the
> modules section (and still declare it in the http handler)

Your problem is that process/2 doesn't tell you the HTTP Method, Host
and Port used by the client?

This feature request is tracked here:
  Provide Host and Port in HTTP requests

The only solutions I could find is to either
A) provide the host again in the URL (as you do right now)
B) or assume in your code that the host used is always the first
defined vhost (call ?MYNAME to get the first vhost).

The problem with option B is that your code wouldn't work correctly if
there are several vhosts defined and the user wants to use host2 or
host3, right?

BTW, instead of www.ejabberd.ru , I guess you mean either
www.ejabberd.im or ejabberd.jabber.ru :)

More information about the ejabberd mailing list