Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D40C28ECF for ; Thu, 18 Aug 2011 17:11:12 +0000 (UTC) Received: (qmail 31457 invoked by uid 500); 18 Aug 2011 17:11:12 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 31371 invoked by uid 500); 18 Aug 2011 17:11:11 -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 31363 invoked by uid 99); 18 Aug 2011 17:11:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 17:11:11 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ctalkobt@ctalkobt.net designates 209.85.210.175 as permitted sender) Received: from [209.85.210.175] (HELO mail-iy0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 17:11:05 +0000 Received: by iyn15 with SMTP id 15so4687557iyn.34 for ; Thu, 18 Aug 2011 10:10:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.45.204 with SMTP id g12mr2046552ibf.79.1313687443574; Thu, 18 Aug 2011 10:10:43 -0700 (PDT) Received: by 10.231.172.204 with HTTP; Thu, 18 Aug 2011 10:10:43 -0700 (PDT) In-Reply-To: References: Date: Thu, 18 Aug 2011 13:10:43 -0400 Message-ID: Subject: Re: Serving static pages with JettyComponent From: Craig Taylor To: users@camel.apache.org Content-Type: multipart/alternative; boundary=0015176f110a6b8fd104aacab1d4 X-Virus-Checked: Checked by ClamAV on apache.org --0015176f110a6b8fd104aacab1d4 Content-Type: text/plain; charset=ISO-8859-1 For Camel 2.2 I ended up implementing a FileDumper() which dumps a file based upon the path directly to the exchange body. Eg: route.choice()..when(header(Exchange.HTTP_PATH).startsWith("/js")).process(fileDumper) and fileDumper psuedo-code is essentially : mimetype = decode filename (Exchange.HTTP_PATH based) exchange.setHeader(Exchange.CONTENT_TYPE, mimeType) exchange.setBody( Resource from baseDirectory + filename . readFile() ) I'd love to find a way to configure the underlying jetty component to do this magic for me but it doesn't appear to be accessible. On Thu, Aug 18, 2011 at 8:06 AM, Joshua Watkins < joshua.watkins@gamesys.co.uk> wrote: > I am using the camel jetty component to route to activemq to access other > backend services. > > For instance: > > from("jetty:http://0.0.0.0:8083/people") > .setHeader(JMS_TYPE, constant("AddPeople")) > .to("activemq:proxy.out").routeId("addPeople"); > > I would also like to serve up some static web pages that are part of the > classpath. Of course, I want to be able to leverage the jetty server that > is already running within the camel jetty component. Unfortunately I am at > a bit of a loss at how do do this. > > > I have tried creating a context handler in spring: > > class="org.eclipse.jetty.server.handler.ContextHandler"> > > > > > And then added it in the list of handlers on the uri: > "jetty:http://0.0.0.0:8083/people??handlers=staticPageHandler" > However that didn't work either. > > Any ideas? Am I missing something simple? > > > > -- ------------------------------------------- Craig Taylor ctalkobt@ctalkobt.net --0015176f110a6b8fd104aacab1d4--