[ejabberd] AtomPub interface

Eric Cestari eric at ohmforce.com
Mon Jun 23 15:51:08 MSD 2008

Le 23 juin 08 à 13:27, Badlop a écrit :

> 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
>  https://support.process-one.net/browse/EJAB-560
That could actually help a lot !
AtomPub requires implementations to give absolute URLs to resources.
Hence  I need to know the hostname/port for composing the URLs to  
serve in the various HTTP feeds.

Yet my code could gather this information to build those URLs. (they  
manage to get there with this URL, that should enough)

> 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?

Absolutely. However using the first vhost would be enough for those  
using ejabberd with one vhost, which could be quite frequent.
I'll start implementing B which shouldn't take long.
Thanks for the tip !

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

Darn, I wanted to give a nicer example than localhost:5280 ... FAIL ! ;)

More information about the ejabberd mailing list