You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Skip Schuler <sk...@gmail.com> on 2008/03/20 23:49:56 UTC

Passing URL parameters to a feed component?

Hi,

I have some data I want to expose as a feed (atom/rss). I've seen the
feed-aggregator-sample, and it works great. Here's my question:

How can I pass a URL parameter to my feed implementation? I'd like to adapt
the feed based on some URL parameter, but am a bit unsure how to best access
it from inside the feed component.


Thanks,
Skip

Re: Passing URL parameters to a feed component?

Posted by Skip Schuler <sk...@gmail.com>.
Thanks much, appreciate the clarification! This looks like a programming
model I can work with :-)

On 3/22/08, Jean-Sebastien Delfino <js...@apache.org> wrote:
>
> Skip Schuler wrote:
> > So the thing is that I need to implement the Servlet interface, is that
> > right?
> >
>
>
> No you don't need to implement the Servlet interface. The workspace
> admin app does more than producing feeds and that's why it implements
> the Servlet interface in addition to the Collection interface used to
> produce feeds.
>
> The following options are available for what you want to do:
>
> A. Implement o.a.t.sca.implementation.data.api.Collection
>
> This is a high level interface allowing you to produce feeds out of
> collections of data items, without having to deal with the details of
> ATOM or RSS in your code.
>
> It has a query method, which will be invoked when the service is invoked
> with query parameters.
>
> The Tuscany tutorial's ShoppingCart [1] shows an example, I just added
> code to it showing how to implement that query() method.
>
> B. Implement o.a.t.sca.binding.atom.collection.Collection
>
> That interface allows you to work with the ATOM feed directly if you
> need to, represented as an o.a.abdera.model.Feed model object. It also
> has a query method.
>
> The feed-aggregator sample [2] shows how to implement that query method,
> and http://localhost:8083/atomAggregator?title=whatever now returns a
> feed of articles with titles containing 'whatever'.
>
> C. Implement o.a.t.sca.binding.rss.collection.Collection to produce RSS
> feeds and in your code work with the RSS feed directly, represented as
> com.sun.syndication.feed.synd.SyndFeed model objects.
>
> This is similar to (B) but for RSS feeds, with a query method as well.
>
> Options (B) and (C) are available starting with Tuscany 1.2 release,
> which we are in the middle of releasing. I'd suggest to try 1.2 release
> candidate 1 as soon as it's available (probably today watch for any
> announcement from Luciano).
>
> You'll see notable changes in 1.2 as it now uses Apache Abdera instead
> of ROME to provide better support for ATOM.
>
> [1]
>
> http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/tutorial/assets/services/ShoppingCartImpl.java
> [2]
>
> http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java
> --
>
> Jean-Sebastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>

Re: Passing URL parameters to a feed component?

Posted by Jean-Sebastien Delfino <js...@apache.org>.
Skip Schuler wrote:
> So the thing is that I need to implement the Servlet interface, is that
> right?
> 

No you don't need to implement the Servlet interface. The workspace 
admin app does more than producing feeds and that's why it implements 
the Servlet interface in addition to the Collection interface used to 
produce feeds.

The following options are available for what you want to do:

A. Implement o.a.t.sca.implementation.data.api.Collection

This is a high level interface allowing you to produce feeds out of 
collections of data items, without having to deal with the details of 
ATOM or RSS in your code.

It has a query method, which will be invoked when the service is invoked 
with query parameters.

The Tuscany tutorial's ShoppingCart [1] shows an example, I just added 
code to it showing how to implement that query() method.

B. Implement o.a.t.sca.binding.atom.collection.Collection

That interface allows you to work with the ATOM feed directly if you 
need to, represented as an o.a.abdera.model.Feed model object. It also 
has a query method.

The feed-aggregator sample [2] shows how to implement that query method, 
and http://localhost:8083/atomAggregator?title=whatever now returns a 
feed of articles with titles containing 'whatever'.

C. Implement o.a.t.sca.binding.rss.collection.Collection to produce RSS 
feeds and in your code work with the RSS feed directly, represented as 
com.sun.syndication.feed.synd.SyndFeed model objects.

This is similar to (B) but for RSS feeds, with a query method as well.

Options (B) and (C) are available starting with Tuscany 1.2 release, 
which we are in the middle of releasing. I'd suggest to try 1.2 release 
candidate 1 as soon as it's available (probably today watch for any 
announcement from Luciano).

You'll see notable changes in 1.2 as it now uses Apache Abdera instead 
of ROME to provide better support for ATOM.

[1] 
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/tutorial/assets/services/ShoppingCartImpl.java
[2] 
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java
-- 
Jean-Sebastien

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Passing URL parameters to a feed component?

Posted by Skip Schuler <sk...@gmail.com>.
So the thing is that I need to implement the Servlet interface, is that
right?


Thanks,
Skip


On Fri, Mar 21, 2008 at 4:43 PM, Raymond Feng <en...@gmail.com> wrote:

> The class is at
>
> http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/CompositeImageCollectionImpl.java
> .
>
> Thanks,
> Raymond
> --------------------------------------------------
> From: "Skip Schuler" <sk...@gmail.com>
> Sent: Friday, March 21, 2008 4:28 PM
> To: <tu...@ws.apache.org>
> Subject: Re: Passing URL parameters to a feed component?
>
> > Hi,
> >
> > Raymond, you are right, that is exactly what I'm looking for (e.g. to
> > personalize the feed, or take some value from a page and pass to the
> > feed).
> >
> > Where can I find workspace-admin and this CompositeImageCollectionImpl?
> I
> > can not see it in the 1.1-incubating distribution.
> >
> >
> > Thanks,
> > Skip
> >
> > On Fri, Mar 21, 2008 at 11:11 AM, Luciano Resende <lu...@gmail.com>
> > wrote:
> >
> >> We do have some support for passing queryStrings today on the atom
> >> binding. See workspace-admin, probably around
> >> CompositeImageCollectionImpl.java.
> >>
> >> On Fri, Mar 21, 2008 at 10:58 AM, Raymond Feng <en...@gmail.com>
> >> wrote:
> >> > Hi,
> >> >
> >> >  Let's assume you have a service exposed over feed binding as
> follows:
> >> >
> >> >  <component name="...">
> >> >     <implementation.java class="test.MyServiceImpl"/>
> >> >     <service name="...">
> >> >         <tuscany:binding.rss
> >> > uri="http://localhost:8083/rssAggregator"/>
> >> >     </service>
> >> >  </component>
> >> >
> >> >  Do you expect that your component impl "test.MyServiceImpl" gets the
> >> >  parameters from the URL and provide functions based on the
> parameters?
> >> For
> >> >  example, http://localhost:8083/rssAggregator?p1=v1&p2=v2, are you
> >> looking
> >> >  for a way to make p1 and p2 available to test.MyServiceImpl?
> >> >
> >> >  Thanks,
> >> >  Raymond
> >> >  --------------------------------------------------
> >> >  From: "Skip Schuler" <sk...@gmail.com>
> >> >  Sent: Thursday, March 20, 2008 3:49 PM
> >> >  To: "tuscany-user" <tu...@ws.apache.org>
> >> >  Subject: Passing URL parameters to a feed component?
> >> >
> >> >
> >> >
> >> >  > Hi,
> >> >  >
> >> >  > I have some data I want to expose as a feed (atom/rss). I've seen
> >> > the
> >> >  > feed-aggregator-sample, and it works great. Here's my question:
> >> >  >
> >> >  > How can I pass a URL parameter to my feed implementation? I'd like
> >> > to
> >> >  > adapt
> >> >  > the feed based on some URL parameter, but am a bit unsure how to
> >> > best
> >> >  > access
> >> >  > it from inside the feed component.
> >> >  >
> >> >  >
> >> >  > Thanks,
> >> >  > Skip
> >> >  >
> >> >
> >> >
>  ---------------------------------------------------------------------
> >> >  To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> >> >  For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Luciano Resende
> >> Apache Tuscany Committer
> >> http://people.apache.org/~lresende<http://people.apache.org/%7Elresende><
> http://people.apache.org/%7Elresende>
> >> http://lresende.blogspot.com/
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>

Re: Passing URL parameters to a feed component?

Posted by Raymond Feng <en...@gmail.com>.
The class is at 
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/modules/workspace-admin/src/main/java/org/apache/tuscany/sca/workspace/admin/impl/CompositeImageCollectionImpl.java.

Thanks,
Raymond
--------------------------------------------------
From: "Skip Schuler" <sk...@gmail.com>
Sent: Friday, March 21, 2008 4:28 PM
To: <tu...@ws.apache.org>
Subject: Re: Passing URL parameters to a feed component?

> Hi,
>
> Raymond, you are right, that is exactly what I'm looking for (e.g. to
> personalize the feed, or take some value from a page and pass to the 
> feed).
>
> Where can I find workspace-admin and this CompositeImageCollectionImpl? I
> can not see it in the 1.1-incubating distribution.
>
>
> Thanks,
> Skip
>
> On Fri, Mar 21, 2008 at 11:11 AM, Luciano Resende <lu...@gmail.com>
> wrote:
>
>> We do have some support for passing queryStrings today on the atom
>> binding. See workspace-admin, probably around
>> CompositeImageCollectionImpl.java.
>>
>> On Fri, Mar 21, 2008 at 10:58 AM, Raymond Feng <en...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> >  Let's assume you have a service exposed over feed binding as follows:
>> >
>> >  <component name="...">
>> >     <implementation.java class="test.MyServiceImpl"/>
>> >     <service name="...">
>> >         <tuscany:binding.rss 
>> > uri="http://localhost:8083/rssAggregator"/>
>> >     </service>
>> >  </component>
>> >
>> >  Do you expect that your component impl "test.MyServiceImpl" gets the
>> >  parameters from the URL and provide functions based on the parameters?
>> For
>> >  example, http://localhost:8083/rssAggregator?p1=v1&p2=v2, are you
>> looking
>> >  for a way to make p1 and p2 available to test.MyServiceImpl?
>> >
>> >  Thanks,
>> >  Raymond
>> >  --------------------------------------------------
>> >  From: "Skip Schuler" <sk...@gmail.com>
>> >  Sent: Thursday, March 20, 2008 3:49 PM
>> >  To: "tuscany-user" <tu...@ws.apache.org>
>> >  Subject: Passing URL parameters to a feed component?
>> >
>> >
>> >
>> >  > Hi,
>> >  >
>> >  > I have some data I want to expose as a feed (atom/rss). I've seen 
>> > the
>> >  > feed-aggregator-sample, and it works great. Here's my question:
>> >  >
>> >  > How can I pass a URL parameter to my feed implementation? I'd like 
>> > to
>> >  > adapt
>> >  > the feed based on some URL parameter, but am a bit unsure how to 
>> > best
>> >  > access
>> >  > it from inside the feed component.
>> >  >
>> >  >
>> >  > Thanks,
>> >  > Skip
>> >  >
>> >
>> >  ---------------------------------------------------------------------
>> >  To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
>> >  For additional commands, e-mail: tuscany-user-help@ws.apache.org
>> >
>> >
>>
>>
>>
>> --
>> Luciano Resende
>> Apache Tuscany Committer
>> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
>> http://lresende.blogspot.com/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Passing URL parameters to a feed component?

Posted by Skip Schuler <sk...@gmail.com>.
Hi,

Raymond, you are right, that is exactly what I'm looking for (e.g. to
personalize the feed, or take some value from a page and pass to the feed).

Where can I find workspace-admin and this CompositeImageCollectionImpl? I
can not see it in the 1.1-incubating distribution.


Thanks,
Skip

On Fri, Mar 21, 2008 at 11:11 AM, Luciano Resende <lu...@gmail.com>
wrote:

> We do have some support for passing queryStrings today on the atom
> binding. See workspace-admin, probably around
> CompositeImageCollectionImpl.java.
>
> On Fri, Mar 21, 2008 at 10:58 AM, Raymond Feng <en...@gmail.com>
> wrote:
> > Hi,
> >
> >  Let's assume you have a service exposed over feed binding as follows:
> >
> >  <component name="...">
> >     <implementation.java class="test.MyServiceImpl"/>
> >     <service name="...">
> >         <tuscany:binding.rss uri="http://localhost:8083/rssAggregator"/>
> >     </service>
> >  </component>
> >
> >  Do you expect that your component impl "test.MyServiceImpl" gets the
> >  parameters from the URL and provide functions based on the parameters?
> For
> >  example, http://localhost:8083/rssAggregator?p1=v1&p2=v2, are you
> looking
> >  for a way to make p1 and p2 available to test.MyServiceImpl?
> >
> >  Thanks,
> >  Raymond
> >  --------------------------------------------------
> >  From: "Skip Schuler" <sk...@gmail.com>
> >  Sent: Thursday, March 20, 2008 3:49 PM
> >  To: "tuscany-user" <tu...@ws.apache.org>
> >  Subject: Passing URL parameters to a feed component?
> >
> >
> >
> >  > Hi,
> >  >
> >  > I have some data I want to expose as a feed (atom/rss). I've seen the
> >  > feed-aggregator-sample, and it works great. Here's my question:
> >  >
> >  > How can I pass a URL parameter to my feed implementation? I'd like to
> >  > adapt
> >  > the feed based on some URL parameter, but am a bit unsure how to best
> >  > access
> >  > it from inside the feed component.
> >  >
> >  >
> >  > Thanks,
> >  > Skip
> >  >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> >  For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >
> >
>
>
>
> --
> Luciano Resende
> Apache Tuscany Committer
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> http://lresende.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>

Re: Passing URL parameters to a feed component?

Posted by Luciano Resende <lu...@gmail.com>.
We do have some support for passing queryStrings today on the atom
binding. See workspace-admin, probably around
CompositeImageCollectionImpl.java.

On Fri, Mar 21, 2008 at 10:58 AM, Raymond Feng <en...@gmail.com> wrote:
> Hi,
>
>  Let's assume you have a service exposed over feed binding as follows:
>
>  <component name="...">
>     <implementation.java class="test.MyServiceImpl"/>
>     <service name="...">
>         <tuscany:binding.rss uri="http://localhost:8083/rssAggregator"/>
>     </service>
>  </component>
>
>  Do you expect that your component impl "test.MyServiceImpl" gets the
>  parameters from the URL and provide functions based on the parameters? For
>  example, http://localhost:8083/rssAggregator?p1=v1&p2=v2, are you looking
>  for a way to make p1 and p2 available to test.MyServiceImpl?
>
>  Thanks,
>  Raymond
>  --------------------------------------------------
>  From: "Skip Schuler" <sk...@gmail.com>
>  Sent: Thursday, March 20, 2008 3:49 PM
>  To: "tuscany-user" <tu...@ws.apache.org>
>  Subject: Passing URL parameters to a feed component?
>
>
>
>  > Hi,
>  >
>  > I have some data I want to expose as a feed (atom/rss). I've seen the
>  > feed-aggregator-sample, and it works great. Here's my question:
>  >
>  > How can I pass a URL parameter to my feed implementation? I'd like to
>  > adapt
>  > the feed based on some URL parameter, but am a bit unsure how to best
>  > access
>  > it from inside the feed component.
>  >
>  >
>  > Thanks,
>  > Skip
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
>  For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>



-- 
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Passing URL parameters to a feed component?

Posted by Raymond Feng <en...@gmail.com>.
Hi,

Let's assume you have a service exposed over feed binding as follows:

<component name="...">
    <implementation.java class="test.MyServiceImpl"/>
    <service name="...">
        <tuscany:binding.rss uri="http://localhost:8083/rssAggregator"/>
    </service>
</component>

Do you expect that your component impl "test.MyServiceImpl" gets the 
parameters from the URL and provide functions based on the parameters? For 
example, http://localhost:8083/rssAggregator?p1=v1&p2=v2, are you looking 
for a way to make p1 and p2 available to test.MyServiceImpl?

Thanks,
Raymond
--------------------------------------------------
From: "Skip Schuler" <sk...@gmail.com>
Sent: Thursday, March 20, 2008 3:49 PM
To: "tuscany-user" <tu...@ws.apache.org>
Subject: Passing URL parameters to a feed component?

> Hi,
>
> I have some data I want to expose as a feed (atom/rss). I've seen the
> feed-aggregator-sample, and it works great. Here's my question:
>
> How can I pass a URL parameter to my feed implementation? I'd like to 
> adapt
> the feed based on some URL parameter, but am a bit unsure how to best 
> access
> it from inside the feed component.
>
>
> Thanks,
> Skip
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org