camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Cheers <m...@infodesigners.com>
Subject Simple HTTP proxy
Date Wed, 28 Nov 2012 00:56:12 GMT
Camel: 2.10.2 Tomcat: 7.0.32 JVM 1.7

I am a new Camel user wanting to initially create a simple server that acts as a front-end
to an existing service. So:

http://newserver/proxy goes to http://oldserver
http://newserver/proxy/x/y/z goes to http://oldserver/x/y/z

The "from" prefix matching works but no matter what i try all "from" endpoints are sent to
http://newserver

Any help would be great, Matt

---------------------

public class RequestHandler extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        this.from("servlet:///?matchOnUriPrefix=true")
                .to("http://newserver?bridgeEndpoint=true&amp;throwExceptionOnFailure=false");
    }};

I've also tried a custom processor that adjusts all of the exchange.getIn() headers i.e.:

Exchange.HTTP_BASE_URI
Exchange.HTTP_URL
Exchange.HTTP_URI
Exchange.HTTP_PATH

without success.

-----------------------

We use tomcat/spring so I started with web.xml of

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:camel-config.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Camel servlet -->
    <servlet>
        <servlet-name>CamelServlet</servlet-name>
        <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

     <!--Camel servlet mapping  app is deployed to /proxy context -->
    <servlet-mapping>
        <servlet-name>CamelServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

----------------------

Camel-config.xml

    <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
        <routeBuilder ref="handler"/>
    </camelContext>

    <bean id="handler" class="myproxy.RequestHandler"/>








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