You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@abdera.apache.org by Tyrell Perera <ty...@wso2.com> on 2007/09/21 09:38:23 UTC

Re: Sample code for an Atom Feed reader

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Akash,

Please refer the in-line comments below.

akashb24@gmail.com wrote:
> Hi Tyrell,
>   This is Akash here. I am relatively new to Apache Abdera
> 
>  How to use Abdera as a Atom feed reader:
>  I  am also trying to write an atom feed reader.(a blog reader or a news reader, like google reader) where we get notified if at all  any updates take place in the websites to which we have subscribed. For instance, I am subscribed to one of the blogsite. If any new blog is  written in that site, I will get notified.
> 
> Now my doubt is how does abdera support these issues in the atom feed reader:
> 1. If I write an atom feed reader of my own, I should be able to subscribe to some of the sites which publish the feeds(sites of news , sports or blogs).
>  How can this subscription be done with the help of atom feed reader.Is there any in built support from Apache  Abdera?
> 
I'm afraid the subscription part needs to be handled by your
application. You can store the feed url in a file or database for
instance and from time to time retrieve the feed and check for updates.

What Abdera provides is the facility to connect to an online feed url
and build a feed model accessible to your java application.

> 2.how do I catch hold of the feeds obtained in the reader and render it to the reader user in the format he desires(html or image etc)?
> 
> 

Feed rendering is also upto you. The feed content varies from site to
site. For instance, some sites give html as content, while others just
give text.

You will have to write the code in your application to retrieve feed
contents using Abdera and render it to the user interface.

Hope this helps,

Tyrell



> How to use Abdera as a Publisher of the feedin my website:
>   Say, I have a blogsite of my own and I want to give atom feed  support to it.
> 1. How can I use Abdera to give the Atom feed support to my blogsite, so that If i write any new blog, a feed is generated automatically with the help of  Abdera.
> 
> 2. how does Abdera convert the blog I have written(which might be in html or some other format) into a feed.
> 
> 3. And finally how do I use APP functions of Abdera to publish this new feed genearated to the users who have subscribed to my site?
> 
> I have gone through some examples in the developerWorks and i know how to read a feed from a site if I know the URI well before hand and I know how to create a feed of my own(specifying the values directly) using the Abdera packages and its methods.
> But I could not find proper tutorial to convert  a content from the website(a new blog or news) into an appropriate feed.
> 
> I am naive in using this Apache Abdera. Kindly bare If you find these questions trivial.
> 
> I would appreciate if you can provide some example working code or tutorial support or links, where I can get 
> more information. 
> I would be very thankful if you can provide the code snippets of your atom feed reader which handles these issues, so that I can start off with the atom feed reader.
> 
> Thank You,
> Akash
> 
> Tyrell Perera-3 wrote:
>> Figured out the issue. The Atom feed I used for testing wasn't well
>> formed.
>>
>> Tyrell
>>
>>
>> Tyrell Perera wrote:
>>> I think I wasn't very clear earlier :)
>>>
>>> The thing is I already have a working APP implementation capable of 
>>> authentication and post/put/delete entries from a given collection.
>>>
>>> I want to implement a 'get' for a Feed. The method will accept an atom 
>>> feed url and generate a Feed model locally.
>>>
>>> My code looks somewhat like the following. I tested with an online feed 
>>> as well as a locally stored feed xml. I keep gettin a 
>>> org.apache.abdera.parser.stax.FOMExtensibleElement exception.
>>>
>>> <code>
>>>
>>> org.apache.abdera.parser.Parser parser = hostObject.abdera.getParser();
>>>             URL url = new URL((String) arguments[0]);
>>>             Feed feed = null;
>>>             try {
>>>                 feed = (Feed) parser.parse(url.openStream()).getRoot();
>>>             } catch (IRISyntaxException e) {
>>>                 e.printStackTrace();
>>>             }
>>>
>>> </code>
>>>
>>> Am I doing something wrong here ?
>>>
>>> thanks,
>>>
>>> Tyrell
>>>
>>> Yogesh Mujumdar wrote:
>>>> You say that you are able to manipulate the feeds, but not able to 
>>>> build a
>>>> feed from a published source over the internet. Do you mean you are 
>>>> not able
>>>> to retrieve the feed from the internet? In which case, you gotta check 
>>>> the
>>>> code which does it.
>>>>
>>>> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>>>>> Thanks for the quick reply. I already have a working APP implementation
>>>>> where authentication and get/post/delete entry are working.
>>>>>
>>>>> I just want to do a basic retrieval of an online feed. Just a simple
>>>>> get
>>>>> and build a Feed model from it. This is failing for some reason. Maybe
>>>>> I'm doing something wrong?
>>>>>
>>>>> Tyrell
>>>>>
>>>>> Yogesh Mujumdar wrote:
>>>>>> AFAIK, Abdera has an example showing how to retrieve and manipulate a
>>>>>> feed/entries and post it back. You can take a look at it and make a
>>>>> start
>>>>>> from there.
>>>>>>
>>>>>> You can as well take any open source feed reader ( RSSowl ) and get 
>>>>>> some
>>>>>> features as well as implementation ideas.
>>>>>>
>>>>>> Good luck to you!
>>>>>>
>>>>>> On 8/8/07, Tyrell Perera <ty...@wso2.com> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am in the process of implementing an Atom feed reader. The
>>>>> requirement
>>>>>>> is to read a published, online feed fully and persist it locally for
>>>>>>> offline manipulation.
>>>>>>>
>>>>>>> I found some useful tutorials at developerworks, which helped in my 
>>>>>>> APP
>>>>>>> stuff tremendously. But I'm a bit stuck with this seemingly simple 
>>>>>>> part
>>>>> :)
>>>>>>> I would appreciate if you can provide some pointers, where I can get
>>>>>>> more information and/or a tutorial.
>>>>>>>
>>>>>>> thanks,
>>>>>>>
>>>>>>> Tyrell
>>>>>>>
>>>>>>
>>>>> -- 
>>>>> Tyrell Perera
>>>>> Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
>>>>> email: tyrell@wso2.com; cell: +94 77 302 2505
>>>>>
>>>>> "Oxygenating the Web Service Platform."
>>>>>
>>>>
>>>>
>> -- 
>> Tyrell Perera
>> Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
>> email: tyrell@wso2.com; cell: +94 77 302 2505
>>
>> "Oxygenating the Web Service Platform."
>>
>>
> Quoted from: 
> http://www.nabble.com/Sample-code-for-an-Atom-Feed-reader-tf4233347.html#a12050732
> 
> 

- --
Tyrell Perera
Senior Software Engineer; WSO2, Inc.; http://www.wso2.com/
email: tyrell@wso2.com; cell: +94 77 302 2505

"Oxygenating the Web Service Platform."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG83TvehFdPcgGx7oRAtnWAKC6PH6A1Kj89yxKKMA34LxYA7XGlACfXawF
mzRuRaqYsZAk24IZZ7Fmr6A=
=zXsj
-----END PGP SIGNATURE-----