camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shing Hing Man <mat...@yahoo.com>
Subject Re: How to redirect an income http get request with new query parameter
Date Mon, 20 Jan 2014 20:30:21 GMT
Thanks for the info !

Shing




On Monday, January 20, 2014 5:55 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
Hi

If you are good at using url rewrite libraries then we have that in Camel too
http://camel.apache.org/urlrewrite.html

Or do as in the bottom of the page, write an impl of that interface
and compute the rewrite url to use.


On Mon, Jan 20, 2014 at 5:52 PM, Shing Hing Man <matmsh@yahoo.com> wrote:
> Hi,
>
>  I have an endpoint to receive an incoming http request. Then use a processor to derive
a new value from some query parameters before
>
> redirecting the request to another URL. Roughly, my code is below.
>
> from("jetty:http4://localhost:8081/test?matchOnUriPrefix=true").to(redirectProcessor);
>
>
> In my RedirectProccessor :
>
> public void process(Exchange exchange) throws Exception {
> HttpServletResponse response = exchange.getIn().getBody(
> HttpServletResponse.class);
> String fooValue = (compute fooValue depends on a HttpRequest parameter).
> String url = "http://a.b.com/test?foo=" + fooValue;
> response.sendRedirect(url);
> }
>
>
>
> I wonder if there is a more elegant way to achieve the above. Something like:
>
>
> from("jetty:http4://localhost:8081/test?matchOnUriPrefix=true").transform(...).("redirect:http://a.b.c.com/test");
>
>
>
> Thanks in advance for any assistance !
>
>
> Shing



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io


Mime
View raw message