Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 45428 invoked from network); 26 Aug 2009 02:09:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Aug 2009 02:09:56 -0000 Received: (qmail 20487 invoked by uid 500); 26 Aug 2009 02:10:21 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 20455 invoked by uid 500); 26 Aug 2009 02:10:21 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 20444 invoked by uid 99); 26 Aug 2009 02:10:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Aug 2009 02:10:21 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of email.wtam@gmail.com designates 74.125.92.145 as permitted sender) Received: from [74.125.92.145] (HELO qw-out-1920.google.com) (74.125.92.145) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Aug 2009 02:10:11 +0000 Received: by qw-out-1920.google.com with SMTP id 5so1894918qwf.44 for ; Tue, 25 Aug 2009 19:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=ylVUrwnhUuNnT8E0ja0ghVGdscqiOxIuQIHsNKOQHwM=; b=yFxiaUkm32VKrmyk3Q+pjn+NJXMCz7zvmangx08LmNPqaxk3e//KZOjNCbGcKdhEII FVeRJyE4QgAim4WCWHEurMC/K3iDc3Fn/B0DcrmseOASPznZNZeD9nJLOxd05YPvgcU6 4D3p8ctQZuaw67DMnPPKS6r1rlP/QR4isa8mw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=QaWAqHkuSRETaY6sP7hFHwHlNFLgVjTLazrOEVo97DT6IiX/vy9EAR57iiucqV+OG2 iRpnou5bZCayL+XVa0z+ZXKpXAZdCi358SI7DY3+g/FIMjVWgKtC16R1PlxhBhozgU43 p1492g4oCISfgvAPNNlYhH88SM9WAeMHQisV4= MIME-Version: 1.0 Received: by 10.224.102.18 with SMTP id e18mr4724218qao.44.1251252590876; Tue, 25 Aug 2009 19:09:50 -0700 (PDT) In-Reply-To: <4A948742.3030706@gmail.com> References: <25136008.post@talk.nabble.com> <4A948742.3030706@gmail.com> Date: Tue, 25 Aug 2009 22:09:50 -0400 Message-ID: Subject: Re: Restlet multiple endpoint considerations From: William Tam To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Todd and Willem, Willem's suggestion would work. We do support multiple URI templates on a same route. So, you could do something like: (also see http://cwiki.apache.org/confluence/display/CAMEL/Restlet) /blah.com/people/{id} /blah.com/people/{id}.json from("restlet:http://localhost:9080?restletUriPatterns=3D#uriTemplates") .process(new Processor() { ... } Or, you can split them into two routes: from("restlet:http://localhost:9080/blah.com/people/{id").process(" ... ") from("restlet:http://localhost:9080/blah.com/people/{id}.json").process(" .= ..") The latter approach creates one camel endpoint per template. So, if you have a lot of templates, you may prefer the first approach. Other than that, the two approaches are equivalent (in terms of performance/scalability) and it comes down to your style and design pattern. Both approaches require only one org.restlet.Component object instance in RestletComponent to support all the URI templates. Hope this help. - William On Tue, Aug 25, 2009 at 8:52 PM, Willem Jiang wrote= : > Hi, > > I don't think current camel supports two froms within a single route. > But you can use the direct endpoint to reuse the route like this > > from("restlet:blah.com/people/{id}").to("direct://myRoute"); > from("restlet:blah.com/people/{id}.json").to("direct://myRoute"); > > from("direct://myRoute")... > > Since the direct endpoint just copy the message exchange , it will not sl= ow > down your application. > > Willem > > > tfredrich wrote: >> >> When using the Restlet component to expose tidy URIs, what would you >> recommend regarding exposing routes as multiple endpoints? =A0For instan= ce, >> a >> single endpoint returns JSON (e.g. /people/toddf returns a JSON object >> describing person ID 'toddf'). =A0Now suppose I want to expose the same >> endpoint with an explicit format URI (e.g. /people/toddf.json) that >> returns >> the same data. >> >> Is it better to have two routes exposed or two 'from()s' in the same >> route? >> >> In other words, which is better: >> >> *Two froms within a single route: >> >> from("restlet:blah.com/people/{id}").from("restlet:blah.com/people/{id}.= json")... >> >> or >> >> * Two separate routes: >> >> from("restlet:blah.com/people/{id}")... >> >> from("restlet:blah.com/people/{id}.json")... >> >> >> Does it make a difference from a scalability, performance, and/or heap >> consumption standpoint? =A0Thanks in advance for your advice. >> >> --Todd > >