camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > gauth
Date Sun, 07 Feb 2010 09:46:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/gauth">gauth</a></h2>
    <h4>Page  <b>added</b> by             <a href="http://cwiki.apache.org/confluence/display/~mrt1nz">Martin
Krasser</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h2><a name="gauth-%7B%7Bgauth%7D%7DComponent"></a><tt>gauth</tt>
Component</h2>

<p><b>Available in Camel 2.3</b> (or latest <a href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-gae/"
rel="nofollow">development snapshot</a>).</p>

<p>The <tt>gauth</tt> component is used by web applications to implement
a <a href="http://code.google.com/apis/accounts/docs/OAuth.html" rel="nofollow">Google-specific
OAuth</a> consumer. It will be later extended to support other <a href="http://oauth.net/"
rel="nofollow">OAuth</a> providers as well. Although this component belongs to the
<a href="/confluence/display/CAMEL/GAE" title="GAE">Camel Components for Google App
Engine</a> (GAE), it can also be used to OAuth-enable non-GAE web applications. For
a detailed description of Google's OAuth implementation refer to the Google <a href="http://code.google.com/apis/accounts/docs/OAuth_ref.html"
rel="nofollow">OAuth API reference</a>.</p>

<h3><a name="gauth-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
gauth:<span class="code-comment">//name[?options]</span>
</pre>
</div></div>
<p>The endpoint <tt>name</tt> can be either <tt>authorize</tt>
or <tt>upgrade</tt>. An <tt>authorize</tt> endpoint is used to obtain
an unauthorized request token from Google and to redirect the user to the authorization page.
The <tt>upgrade</tt> endpoint is used to process OAuth callbacks from Google and
to upgrade an authorized request token to a long-lived access token. Refer to the <a href="#gauth-Usage">usage
section</a> for an example.</p>

<h3><a name="gauth-Options"></a>Options</h3>

<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Default Value </th>
<th class='confluenceTh'> Required </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>callback</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> true (can alternatively be set via <tt>GAuthAuthorizeBinding.GAUTH_CALLBACK</tt>
<a href="#gauth-Messageheaders">message header</a>) </td>
<td class='confluenceTd'> URL where to redirect the user after having granted or denied
access. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>scope</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> true (can alternatively be set via <tt>GAuthAuthorizeBinding.GAUTH_SCOPE</tt>
<a href="#gauth-Messageheaders">message header</a>) </td>
<td class='confluenceTd'> URL identifying the service(s) to be accessed. Scopes are
defined by each Google service; see the service's documentation for the correct value. To
specify more than one scope, list each one separated with a comma. Example: <tt><a
href="http://www.google.com/calendar/feeds/" rel="nofollow">http://www.google.com/calendar/feeds/</a></tt>.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>consumerKey</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> true (can alternatively be set on <a href="#gauth-Componentconfiguration">component-level</a>).
</td>
<td class='confluenceTd'> Domain identifying the web application. This is the domain
used when registering the application with Google. Example: <tt>camelcloud.appspot.com</tt>.
For a non-registered application use <tt>anonymous</tt>. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>consumerSecret</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> one of <tt>consumerSecret</tt> or <tt>keyLoaderRef</tt>
is required (can alternatively be set on <a href="#gauth-Componentconfiguration">component-level</a>).
</td>
<td class='confluenceTd'> Consumer secret of the web application. The consumer secret
is generated when when registering the application with Google. It is needed if the HMAC-SHA1
signature method shall be used. For a non-registered application use <tt>anonymous</tt>.
</td>
</tr>
<tr>
<td class='confluenceTd'> <tt>keyLoaderRef</tt> </td>
<td class='confluenceTd'> <tt>null</tt> </td>
<td class='confluenceTd'> one of <tt>consumerSecret</tt> or <tt>keyLoaderRef</tt>
is required (can be alternatively set on <a href="#gauth-Componentconfiguration">component-level</a>)
</td>
<td class='confluenceTd'> Reference to a private key loader in the registry. Part of
<tt>camel-gae</tt> are two key loaders: <tt>GAuthPk8Loader</tt> for
loading a private key from a PKCS#8 file and <tt>GAuthJksLoader</tt> to load a
private key from a Java key store. It is needed if the RSA-SHA1 signature method shall be
used. These classes are defined in the <tt>org.apache.camel.component.gae.auth</tt>
package. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>authorizeBindingRef</tt> </td>
<td class='confluenceTd'> Reference to <tt>GAuthAuthorizeBinding</tt> </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> Reference to a <tt>OutboundBinding&lt;GAuthEndpoint,
GoogleOAuthParameters, GoogleOAuthParameters&gt;</tt> in the registry for customizing
how an <tt>Exchange</tt> is bound to <tt>GoogleOAuthParameters</tt>.
This binding is used for teh authorization phase. Most applications won't change the default
value. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>upgradeBindingRef</tt> </td>
<td class='confluenceTd'> Reference to <tt>GAuthAuthorizeBinding</tt> </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> Reference to a <tt>OutboundBinding&lt;GAuthEndpoint,
GoogleOAuthParameters, GoogleOAuthParameters&gt;</tt> in the registry.  for customizing
how an <tt>Exchange</tt> is bound to <tt>GoogleOAuthParameters</tt>.
This binding is used for teh token upgrade phase. Most applications won't change the default
value. </td>
</tr>
</tbody></table>

<h3><a name="gauth-Messageheaders"></a>Message headers</h3>

<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Endpoint </th>
<th class='confluenceTh'> Message </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>GAuthAuthorizeBinding.GAUTH_CALLBACK</tt>
</td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <tt>gauth:authorize</tt> </td>
<td class='confluenceTd'> in </td>
<td class='confluenceTd'> Overrides the <tt>callback</tt> option. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>GAuthAuthorizeBinding.GAUTH_SCOPE</tt> </td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <tt>gauth:authorize</tt> </td>
<td class='confluenceTd'> in </td>
<td class='confluenceTd'> Overrides the <tt>scope</tt> option. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN</tt>
</td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <tt>gauth:upgrade</tt> </td>
<td class='confluenceTd'> out </td>
<td class='confluenceTd'> Contains the long-lived access token. This token should be
stored by the applications in context of a user. </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN_SECRET</tt>
</td>
<td class='confluenceTd'> <tt>String</tt> </td>
<td class='confluenceTd'> <tt>gauth:upgrade</tt> </td>
<td class='confluenceTd'> out </td>
<td class='confluenceTd'> Contains the access token secret. This token secret should
be stored by the applications in context of a user. </td>
</tr>
</tbody></table>

<h3><a name="gauth-Messagebody"></a>Message body</h3>

<p>The <tt>gauth</tt> component doesn't read or write message bodies.</p>

<h3><a name="gauth-Componentconfiguration"></a>Component configuration</h3>

<p>Some endpoint options such as <tt>consumerKey</tt>, <tt>consumerSecret</tt>
or <tt>keyLoader</tt> are usually set to the same values on <tt>gauth:authorize</tt>
and <tt>gauth:upgrade</tt> endpoints. The <tt>gauth</tt> component
allows to configure them on component-level. These settings are then inherited by <tt>gauth</tt>
endpoints and need not be set redundantly in the endpoint URIs. Here are some configuration
examples.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>component configuration for a registered web
application using the HMAC-SHA1 signature method</b></div><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;bean id=<span class="code-quote">"gauth"</span>
class=<span class="code-quote">"org.apache.camel.component.gae.auth.GAuthComponent"</span>&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"consumerKey"</span>
value=<span class="code-quote">"example.appspot.com"</span> /&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"consumerSecret"</span>
value=<span class="code-quote">"QAtA...HfQ"</span> /&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>component configuration for an unregistered
web application using the HMAC-SHA1 signature method</b></div><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;bean id=<span class="code-quote">"gauth"</span>
class=<span class="code-quote">"org.apache.camel.component.gae.auth.GAuthComponent"</span>&gt;</span>
    <span class="code-tag"><span class="code-comment">&lt;!-- Google will
display a warning message on the authorization page --&gt;</span></span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"consumerKey"</span>
value=<span class="code-quote">"anonymous"</span> /&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"consumerSecret"</span>
value=<span class="code-quote">"anonymous"</span> /&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>component configuration for a registered web
application using the RSA-SHA1 signature method</b></div><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;bean id=<span class="code-quote">"gauth"</span>
class=<span class="code-quote">"org.apache.camel.component.gae.auth.GAuthComponent"</span>&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"consumerKey"</span>
value=<span class="code-quote">"ipfcloud.appspot.com"</span> /&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"keyLoader"</span>
ref=<span class="code-quote">"jksLoader"</span> /&gt;</span>
    <span class="code-tag"><span class="code-comment">&lt;!--&lt;property
name=<span class="code-quote">"keyLoader"</span> ref=<span class="code-quote">"pk8Loader"</span>
/&gt;</span>--&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>

<span class="code-tag"><span class="code-comment">&lt;!-- Loads the private
key from a Java key store --&gt;</span></span>
&lt;bean id=<span class="code-quote">"jksLoader"</span>
    class=<span class="code-quote">"org.apache.camel.component.gae.auth.GAuthJksLoader"</span>&gt;
    <span class="code-tag">&lt;property name=<span class="code-quote">"keyStoreLocation"</span>
value=<span class="code-quote">"myKeytore.jks"</span> /&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"keyAlias"</span>
value=<span class="code-quote">"myKey"</span> /&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"keyPass"</span>
value=<span class="code-quote">"myKeyPassword"</span> /&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"storePass"</span>
value=<span class="code-quote">"myStorePassword"</span> /&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>

<span class="code-tag"><span class="code-comment">&lt;!-- Loads the private
key from a PKCS#8 file --&gt;</span></span>
&lt;bean id=<span class="code-quote">"pk8Loader"</span>
    class=<span class="code-quote">"org.apache.camel.component.gae.auth.GAuthPk8Loader"</span>&gt;
    <span class="code-tag">&lt;property name=<span class="code-quote">"keyStoreLocation"</span>
value=<span class="code-quote">"myKeyfile.pk8"</span> /&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>

<h3><a name="gauth-Usage"></a>Usage</h3>

<p>Here's the minimum setup for adding OAuth to a (non-GAE) web application. In the
following example, it is assumed that the web application is running on <tt>gauth.example.org</tt>.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>GAuthRouteBuilder</b></div><div
class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">import</span> java.net.URLEncoder;
<span class="code-keyword">import</span> org.apache.camel.builder.RouteBuilder;

<span class="code-keyword">public</span> class TutorialRouteBuilder <span class="code-keyword">extends</span>
RouteBuilder {

    @Override
    <span class="code-keyword">public</span> void configure() <span class="code-keyword">throws</span>
Exception {

        <span class="code-comment">// Calback URL to redirect user from Google Authorization
back to the web application
</span>        <span class="code-object">String</span> encodedCallback =
URLEncoder.encode(<span class="code-quote">"https:<span class="code-comment">//gauth.example.org:8443/handler"</span>,
<span class="code-quote">"UTF-8"</span>);
</span>        <span class="code-comment">// Application will request <span
class="code-keyword">for</span> authorization to access a user's Google Calendar
</span>        <span class="code-object">String</span> encodedScope = URLEncoder.encode(<span
class="code-quote">"http:<span class="code-comment">//www.google.com/calendar/feeds/"</span>,
<span class="code-quote">"UTF-8"</span>);
</span>
        <span class="code-comment">// Route 1: A GET request to http://gauth.example.org/authorize
will trigger the the OAuth
</span>        <span class="code-comment">// sequence of interactions. The gauth:authorize
endpoint obtains an unauthorized request
</span>        <span class="code-comment">// token from Google and then redirects
the user (browser) to a Google authorization page.
</span>        from(<span class="code-quote">"jetty:http:<span class="code-comment">//0.0.0.0:8080/authorize"</span>)
</span>            .to(<span class="code-quote">"gauth:authorize?callback="</span>
+ encodedCallback + <span class="code-quote">"&amp;scope="</span> + encodedScope);

        <span class="code-comment">// Route 2: Handle callback from Google. After the
user granted access to Google Calendar
</span>        <span class="code-comment">// Google redirects the user to https://gauth.example.org:8443/handler
(see callback) along
</span>        <span class="code-comment">// with an authorized request token.
The gauth:access endpoint exchanges the authorized
</span>        <span class="code-comment">// request token against a <span
class="code-object">long</span>-lived access token.
</span>        from(<span class="code-quote">"jetty:https:<span class="code-comment">//0.0.0.0:8443/handler"</span>)
</span>            .to(<span class="code-quote">"gauth:upgrade"</span>)
            <span class="code-comment">// The access token can be obtained from
</span>            <span class="code-comment">// exchange.getOut().getHeader(GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN)
</span>            <span class="code-comment">// The access token secret can be
obtained from
</span>            <span class="code-comment">// exchange.getOut().getHeader(GAuthUpgradeBinding.GAUTH_ACCESS_TOKEN_SECRET)
</span>            .process(/* store the tokens in context of the current user ... */);
    }

}
</pre>
</div></div>
<p>The OAuth sequence is triggered by sending a GET request to <tt><a href="http://gauth.example.org/authorize"
rel="nofollow">http://gauth.example.org/authorize</a></tt>. The user is then
redirected to a Google authorization page. After having granted access on this page, Google
redirects the user to the web application which handles the callback and finally obtains a
long-lived access token from Google.</p>

<p>These two routes can perfectly co-exist with any other web application framework.
The framework provides the basis for web application-specific functionality whereas the OAuth
service provider integration is done with Apache Camel. The OAuth integration part could even
use resources from an existing servlet container by using the <tt>servlet</tt>
component instead of the <tt>jetty</tt> component.</p>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>What to do with the OAuth
access token?</b><br /><ul>
	<li>Application should store the access token in context of the current user. If the
user logs in next time, the access token can directly be loaded from the database, for example,
without doing the <em>OAuth dance</em> again.</li>
	<li>The access token is then used to get access to Google services, such as a Google
Calendar API, on behalf of the user. Java applications will most likely use the <a href="http://code.google.com/p/gdata-java-client/"
rel="nofollow">GData Java library</a> for that. See below for an <a href="#gauth-Accesstokenusage">example</a>
how to use the access token with the GData Java library to read a user's calendar feed.</li>
	<li>The user can revoke the access token at any time from his <a href="https://www.google.com/accounts"
rel="nofollow">Google Accounts</a> page. In this case, access to the corresponding
Google service will throw an authorization exception. The web application should remove the
stored access token and redirect the user again to the Google authorization page for creating
another one.</li>
</ul>
</td></tr></table></div>
<p>The above example relies on the following component configuration.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;bean id=<span class="code-quote">"gauth"</span>
class=<span class="code-quote">"org.apache.camel.component.gae.auth.GAuthComponent"</span>&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"consumerKey"</span>
value=<span class="code-quote">"anonymous"</span> /&gt;</span>
    <span class="code-tag">&lt;property name=<span class="code-quote">"consumerSecret"</span>
value=<span class="code-quote">"anonymous"</span> /&gt;</span>
<span class="code-tag">&lt;/bean&gt;</span>
</pre>
</div></div>
<p>If you don't want that Google displays a warning message on the authorization page,
you'll need to <a href="http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html"
rel="nofollow">register</a> your web application and change the <tt>consumerKey</tt>
and <tt>consumerSecret</tt> settings.</p>

<h4><a name="gauth-GAEexample"></a>GAE example</h4>

<p>To OAuth-enable a Google App Engine application, only some small changes in the route
builder are required. Assuming the GAE application hostname is <tt>camelcloud.appspot.com</tt>
a configuration might look as follows. Here, the <a href="/confluence/display/CAMEL/ghttp"
title="ghttp">ghttp</a> component is used to handle HTTP(S) requests instead of the
<tt>jetty</tt> component.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>GAuthRouteBuilder</b></div><div
class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">import</span> java.net.URLEncoder;
<span class="code-keyword">import</span> org.apache.camel.builder.RouteBuilder;

<span class="code-keyword">public</span> class TutorialRouteBuilder <span class="code-keyword">extends</span>
RouteBuilder {

    @Override
    <span class="code-keyword">public</span> void configure() <span class="code-keyword">throws</span>
Exception {

        <span class="code-object">String</span> encodedCallback = URLEncoder.encode(<span
class="code-quote">"https:<span class="code-comment">//camelcloud.appspot.com/handler"</span>,
<span class="code-quote">"UTF-8"</span>);
</span>        <span class="code-object">String</span> encodedScope = URLEncoder.encode(<span
class="code-quote">"http:<span class="code-comment">//www.google.com/calendar/feeds/"</span>,
<span class="code-quote">"UTF-8"</span>);
</span>
        from(<span class="code-quote">"ghttp:<span class="code-comment">///authorize"</span>)
</span>            .to(<span class="code-quote">"gauth:authorize?callback="</span>
+ encodedCallback + <span class="code-quote">"&amp;scope="</span> + encodedScope);

        from(<span class="code-quote">"ghttp:<span class="code-comment">///handler"</span>)
</span>            .to(<span class="code-quote">"gauth:upgrade"</span>)
            .process(/* store the tokens in context of the current user ... */);
    }

}
</pre>
</div></div>

<h4><a name="gauth-Accesstokenusage"></a>Access token usage</h4>

<p>Here's an example how to use an access token to access a user's Google Calendar data
with the <a href="http://code.google.com/p/gdata-java-client/" rel="nofollow">GData
Java library</a>. The example application writes the titles of the user's public and
private calendars to <tt>stdout</tt>.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>Access token usage</b></div><div
class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">import</span> com.google.gdata.client.authn.oauth.OAuthHmacSha1Signer;
<span class="code-keyword">import</span> com.google.gdata.client.authn.oauth.OAuthParameters;
<span class="code-keyword">import</span> com.google.gdata.client.calendar.CalendarService;
<span class="code-keyword">import</span> com.google.gdata.data.calendar.CalendarEntry;
<span class="code-keyword">import</span> com.google.gdata.data.calendar.CalendarFeed;

<span class="code-keyword">import</span> java.net.URL;

<span class="code-keyword">public</span> class AccessExample {

    <span class="code-keyword">public</span> <span class="code-keyword">static</span>
void main(<span class="code-object">String</span>... args) <span class="code-keyword">throws</span>
Exception {
        <span class="code-object">String</span> accessToken = ...
        <span class="code-object">String</span> accessTokenSecret = ...

        CalendarService myService = <span class="code-keyword">new</span> CalendarService(<span
class="code-quote">"exampleCo-exampleApp-1.0"</span>);
        OAuthParameters params = <span class="code-keyword">new</span> OAuthParameters();
        params.setOAuthConsumerKey(<span class="code-quote">"anonymous"</span>);
        params.setOAuthConsumerSecret(<span class="code-quote">"anonymous"</span>);
        params.setOAuthToken(accessToken);
        params.setOAuthTokenSecret(accessTokenSecret);
        myService.setOAuthCredentials(params, <span class="code-keyword">new</span>
OAuthHmacSha1Signer());

        URL feedUrl = <span class="code-keyword">new</span> URL(<span class="code-quote">"http:<span
class="code-comment">//www.google.com/calendar/feeds/<span class="code-keyword">default</span>/"</span>);
</span>        CalendarFeed resultFeed = myService.getFeed(feedUrl, CalendarFeed.class);

        <span class="code-object">System</span>.out.println(<span class="code-quote">"Your
calendars:"</span>);
        <span class="code-object">System</span>.out.println();

        <span class="code-keyword">for</span> (<span class="code-object">int</span>
i = 0; i &lt; resultFeed.getEntries().size(); i++) {
            CalendarEntry entry = resultFeed.getEntries().get(i);
            <span class="code-object">System</span>.out.println(entry.getTitle().getPlainText());
        }
    }
}
</pre>
</div></div>

<h3><a name="gauth-Dependencies"></a>Dependencies</h3>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>pom.xml</b></div><div class="codeContent
panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;dependency&gt;</span>
    <span class="code-tag">&lt;groupId&gt;</span>org.apache.camel<span
class="code-tag">&lt;/groupId&gt;</span>
    <span class="code-tag">&lt;artifactId&gt;</span>camel-gae<span
class="code-tag">&lt;/artifactId&gt;</span>
    <span class="code-tag">&lt;version&gt;</span>${camel-version}<span
class="code-tag">&lt;/version&gt;</span>
<span class="code-tag">&lt;/dependency&gt;</span>
</pre>
</div></div>
<p>where <tt>${camel-version</tt>} must be replaced by the actual version
of Camel (2.3.0 or higher).</p>
<h3><a name="gauth-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/gauth">View Online</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/gauth?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message