Getting started with AtomPub

View: New views
4 Messages — Rating Filter:   Alert me  

Getting started with AtomPub

by Roy Walter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Making collections available as ATOM feeds has relevance to my project
but I am confused about how I get started once I have enabled the module
in server.xml.

The docs state that for a collection to be a feed the file .feed.atom
must exist in the collection. Fair enough, but for starters what should
the .feed.atom file contain?

Thanks in advance,
Roy

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Getting started with AtomPub

by FraserHore :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think the .feed.atom file can be as simple as:

<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
    <id xmlns="http://www.w3.org/2005/Atom">urn:uuid:1197bd3c-cfbd-441c-bc8a-6c2902e96e49</id>
    <updated xmlns="http://www.w3.org/2005/Atom">2009-09-13T02:34:17+02:00</updated>
    <link xmlns="http://www.w3.org/2005/Atom" href="#" rel="edit" type="application/atom+xml"/>
    <link xmlns="http://www.w3.org/2005/Atom" href="#" rel="self" type="application/atom+xml"/>
    <atom:title/>
</atom:feed>

If you post a simple feed instance with what ever elements you want to a collection at /exist/atom/edit/some/collection/path, the atompub service will add the id, updated and link elements and save the instance as a .feed.atom resource in the collection.  Note that you have to post the instance with a mediatype of application/atom+xml in order for the atompub service to store in properly as an atom feed rather than a normal xml resource.

For example you could use an xfom submission:

    <xf:submission id="createFeed" replace="none" ref="instance('feedTemplate')" method="post" mediatype="application/atom+xml">
        <xf:resource>/exist/atom/edit/some/collection/path</xf:resource>
    </xf:submission>

Then if you post a simple atom entry to the same collection path the atompub service will add the relevant elements to the instance, create a sub-collection named .feed.entry and store the entry instance in the new sub-collection.

Hope this helps.

Cheers,

Fraser



On Mon, Nov 9, 2009 at 11:04 PM, Roy Walter <walt@...> wrote:
Making collections available as ATOM feeds has relevance to my project
but I am confused about how I get started once I have enabled the module
in server.xml.

The docs state that for a collection to be a feed the file .feed.atom
must exist in the collection. Fair enough, but for starters what should
the .feed.atom file contain?

Thanks in advance,
Roy

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Getting started with AtomPub

by Roy Walter-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Fraser,

Thanks for that. Very useful.

I am now creating feeds using curl but this looks like a good chance to
make a start with XForms. In this context, how is username/password
authentication handled when submitting to the server?

Best regards,
Roy

Fraser Hore wrote:

> I think the .feed.atom file can be as simple as:
>
> <atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
>     <id
> xmlns="http://www.w3.org/2005/Atom">urn:uuid:1197bd3c-cfbd-441c-bc8a-6c2902e96e49</id>
>     <updated
> xmlns="http://www.w3.org/2005/Atom">2009-09-13T02:34:17+02:00</updated>
>     <link xmlns="http://www.w3.org/2005/Atom" href="#" rel="edit"
> type="application/atom+xml"/>
>     <link xmlns="http://www.w3.org/2005/Atom" href="#" rel="self"
> type="application/atom+xml"/>
>     <atom:title/>
> </atom:feed>
>
> If you post a simple feed instance with what ever elements you want to
> a collection at /exist/atom/edit/some/collection/path, the atompub
> service will add the id, updated and link elements and save the
> instance as a .feed.atom resource in the collection.  Note that you
> have to post the instance with a mediatype of application/atom+xml in
> order for the atompub service to store in properly as an atom feed
> rather than a normal xml resource.
>
> For example you could use an xfom submission:
>
>     <xf:submission id="createFeed" replace="none"
> ref="instance('feedTemplate')" method="post"
> mediatype="application/atom+xml">
>         <xf:resource>/exist/atom/edit/some/collection/path</xf:resource>
>     </xf:submission>
>
> Then if you post a simple atom entry to the same collection path the
> atompub service will add the relevant elements to the instance, create
> a sub-collection named .feed.entry and store the entry instance in the
> new sub-collection.
>
> Hope this helps.
>
> Cheers,
>
> Fraser
>
>
>
> On Mon, Nov 9, 2009 at 11:04 PM, Roy Walter <walt@...
> <mailto:walt@...>> wrote:
>
>     Making collections available as ATOM feeds has relevance to my project
>     but I am confused about how I get started once I have enabled the
>     module
>     in server.xml.
>
>     The docs state that for a collection to be a feed the file .feed.atom
>     must exist in the collection. Fair enough, but for starters what
>     should
>     the .feed.atom file contain?
>
>     Thanks in advance,
>     Roy
>
>     ------------------------------------------------------------------------------
>     Let Crystal Reports handle the reporting - Free Crystal Reports
>     2008 30-Day
>     trial. Simplify your report design, integration and deployment -
>     and focus on
>     what you do best, core application coding. Discover what's new with
>     Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>     _______________________________________________
>     Exist-open mailing list
>     Exist-open@...
>     <mailto:Exist-open@...>
>     https://lists.sourceforge.net/lists/listinfo/exist-open
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.425 / Virus Database: 270.14.59/2494 - Release Date: 11/10/09 07:38:00
>
>  

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: Getting started with AtomPub

by FraserHore :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You can create a simple login instance, such as:
    <xf:instance xmlns="" id="login">
        <cms:Login xmlns:cms="http://www.innoventive.org/cms">
            <cms:Username>Username</cms:Username>
            <cms:Password>Password</cms:Password>
        </cms:Login>
    </xf:instance>   

A submission such as:

    <xf:submission id="loginSubmission" replace="none" ref="instance('login')" method="post">
        <xf:resource value="concat(instance('resources')/LoginResource, '/', instance('login')/cms:Username, '/', instance('login')/cms:Password)"/>
        <xf:action ev:event="xforms-submit-done">
            <xf:load ref="instance('resources')/RedirectURL" show="replace"/>
        </xf:action>
    </xf:submission>

And then create a login form, such as:

<xf:group class="content-view-login" ref="instance('login')" xmlns:xf="http://www.w3.org/2002/xforms">
    <xf:label>
        <h1>Login</h1>
    </xf:label>
    <div>
        This is a protected resource. Only registered database users can log in.
    </div>
    <xf:group class="username-password">
        <xf:input ref="cms:Username">
            <xf:label>Username</xf:label>
        </xf:input>
        <xf:secret ref="cms:Password">
            <xf:label>Password</xf:label>
        </xf:secret>
    </xf:group>
    <xf:group class="triggerGroup">
        <xf:submit submission="loginSubmission">
            <xf:label>Submit</xf:label>
        </xf:submit>
    </xf:group>   
</xf:group>

Notice the xf:secret control masks the password.  I'm not sure if this is the most secure method.  I have noticed that when I display the submit done messages the password is clearly visible in the resource uri.  I'm not sure if this is an issue or not.

Cheers,

Fraser




On Tue, Nov 10, 2009 at 11:46 PM, Roy Walter <garliestonhouse@...> wrote:
Hi Fraser,

Thanks for that. Very useful.

I am now creating feeds using curl but this looks like a good chance to make a start with XForms. In this context, how is username/password authentication handled when submitting to the server?

Best regards,
Roy

Fraser Hore wrote:
I think the .feed.atom file can be as simple as:

<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
   <id xmlns="http://www.w3.org/2005/Atom">urn:uuid:1197bd3c-cfbd-441c-bc8a-6c2902e96e49</id>
   <updated xmlns="http://www.w3.org/2005/Atom">2009-09-13T02:34:17+02:00</updated>
   <link xmlns="http://www.w3.org/2005/Atom" href="#" rel="edit" type="application/atom+xml"/>
   <link xmlns="http://www.w3.org/2005/Atom" href="#" rel="self" type="application/atom+xml"/>
   <atom:title/>
</atom:feed>

If you post a simple feed instance with what ever elements you want to a collection at /exist/atom/edit/some/collection/path, the atompub service will add the id, updated and link elements and save the instance as a .feed.atom resource in the collection.  Note that you have to post the instance with a mediatype of application/atom+xml in order for the atompub service to store in properly as an atom feed rather than a normal xml resource.

For example you could use an xfom submission:

   <xf:submission id="createFeed" replace="none" ref="instance('feedTemplate')" method="post" mediatype="application/atom+xml">
       <xf:resource>/exist/atom/edit/some/collection/path</xf:resource>
   </xf:submission>

Then if you post a simple atom entry to the same collection path the atompub service will add the relevant elements to the instance, create a sub-collection named .feed.entry and store the entry instance in the new sub-collection.

Hope this helps.

Cheers,

Fraser



On Mon, Nov 9, 2009 at 11:04 PM, Roy Walter <walt@... <mailto:walt@...>> wrote:

   Making collections available as ATOM feeds has relevance to my project
   but I am confused about how I get started once I have enabled the
   module
   in server.xml.

   The docs state that for a collection to be a feed the file .feed.atom
   must exist in the collection. Fair enough, but for starters what
   should
   the .feed.atom file contain?

   Thanks in advance,
   Roy

   ------------------------------------------------------------------------------
   Let Crystal Reports handle the reporting - Free Crystal Reports
   2008 30-Day
   trial. Simplify your report design, integration and deployment -
   and focus on
   what you do best, core application coding. Discover what's new with
   Crystal Reports now.  http://p.sf.net/sfu/bobj-july
   _______________________________________________
   Exist-open mailing list
   Exist-open@...
   <mailto:Exist-open@...> ------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.425 / Virus Database: 270.14.59/2494 - Release Date: 11/10/09 07:38:00

 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open