camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Taylor <ctalk...@ctalkobt.net>
Subject Re: Serving static pages with JettyComponent
Date Thu, 18 Aug 2011 17:10:43 GMT
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:
>
> <bean id="staticPageHandler"
> class="org.eclipse.jetty.server.handler.ContextHandler">
>        <property name="contextPath" value="/"/>
>        <property name="resourceBase" value="./resources/web" />
>        </bean>
>
> 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message