camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: using jetty request params in xml-defined route
Date Wed, 03 Sep 2008 12:16:50 GMT
Hi

Yes please create a JIRA for this as you can only get the http request parameters by using
a the getHttpRequest on the HttpExchange and thus you need java code and can't do it from
the simple expression language.

I think it should be able to access the httprequest parameters from exchange.in.header, then
its easy to use content based routing as well.




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Steve A. [mailto:steve@asanderson.com] 
Sent: 3. september 2008 13:37
To: camel-user@activemq.apache.org
Subject: RE: using jetty request params in xml-defined route




Claus Ibsen wrote:
> 
> Its easier to help if you post a snippet of your route.
> I would assume that the parameters is stored in the in message as headers.
> So you should be able to access them using the simple language from the
> xml routing also.
> <simple>in.header.foo</simple>
> 

Actually, it would be great if that were possible, but as far as I can tell,
the http request parameters never get set in the header nor properties of
the jetty exchange.

e.g. if the request is http://localhost:8080/test?x=1, then x is not
accessible via ${in.header.x}, ${in.body}, or ${property.x}.

<route>
   <from uri="jetty:http://localhost:8080/test" />
   <setBody>
      <simple>&lt;html>&lt;body>${in.header.x}&lt;/body>&lt;/html></simple>
   </setBody>
</route>

Of course, if I replace the <setBody> above to a <process> and create a
Processor Java class that contains the following, then it works, but I'd
like to keep the routes in the Spring xml to the extent possible, since
run-time configuration changes are a major goal:

	public void process(Exchange exchange) throws Exception {
		HttpServletRequest req =
exchange.getIn().getBody(HttpServletRequest.class);
		exchange.getOut(true).setBody("<html><body>" + req.getParameter("x") +
"</body></html>");
	}

Please advise if my understanding of how this works is incorrect, or if this
should be a JIRA enhancement for the Jetty component.

Thanks in advance,

Steve
-- 
View this message in context: http://www.nabble.com/using-jetty-request-params-in-xml-defined-route-tp19277002s22882p19287503.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message