camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james.strac...@gmail.com>
Subject background on the Web Console codebase (was Re: [jira] Work started: (CAMEL-1655) Groovy Route Editor for WebConsole
Date Wed, 03 Jun 2009 08:10:56 GMT
Hi Xueqiang!

2009/6/3 alloyer <alloyer@gmail.com>:
>
> Hi All,
> I am Xueqiang Mi and alloyer is my ID on mailing list and IRC. I am a
> student of China and major in middleware technologies.
> I have been starting my work for about one week. Now I am reading the XML
> rotue editor code and try to learn a overview of the implementation of
> camel-web component.

Here's a quick overview to help you dive into the code. Its basically
written using the JAX-RS specification; I'd recommend reading the
JAX-RS specificatio, the Jersey user guide
https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html

and looking at the various examples in Jersey to get your head around
this programming model. Its a great way to build web applications!
https://jersey.dev.java.net/

The neat thing is a single controller implementation then works for
building RESTful services (serving up XML, JSON, text, csv, DOT files
and so forth) as well as a HTML web application too. We're using
Jersey's support for Implicit Views which basically means for a
resource bean, a JSP file is found in webapp/$className/index.jsp.

(I'm considering porting the JSP/custom tags/JSTL/SiteMesh combination
over to use Lift templates which are way simpler and cleaner - but
thats another discussion and I probably won't get around to doing it
for a while).

Most of the heavy duty work then just takes place in the resource beans...
https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/

for example here's how the endpoints are viewed and new ones posted
https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/EndpointsResource.java

which is navigated to from the root URI
https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java

see the use of @Path("endpoints") etc

You can browse the API of the resource beans automatically as
described here thanks to the WADL support in Jersey:
http://camel.apache.org/web-console.html

In terms of viewing/editing routes, this is all taken care of by this
resource...
https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/RouteResource.java

see the @POST methods. So you could start if you like diving straight
into this class and hacking it to support other languages (it kinda
assumes XML payloads currently). The method is postRouteForm() which
takes a form encoded submission and extracts the String and currently
assumes its an XML payload. So we'd need some kind of field to denote
what language the user wants the route to be expressed in etc.

I hope that helps a little! Feel free to shoot any questions you have
on the WebConsole to this list!

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Mime
View raw message