Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从码头到绝对URL的驼峰路线_Java_Routing_Osgi_Apache Camel_Apache Karaf - Fatal编程技术网

Java 从码头到绝对URL的驼峰路线

Java 从码头到绝对URL的驼峰路线,java,routing,osgi,apache-camel,apache-karaf,Java,Routing,Osgi,Apache Camel,Apache Karaf,我在ApacheKaraf上部署了一个OSGi包。我有一条简单的骆驼路线: <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="jetty:http://0.0.0.0:8282/services?handlers=securityHandler&amp;matchOnUriPr

我在ApacheKaraf上部署了一个
OSGi
包。我有一条简单的骆驼路线:

    <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="jetty:http://0.0.0.0:8282/services?handlers=securityHandler&amp;matchOnUriPrefix=true"/>
            <setHeader headerName="CamelHttpQuery">
                <constant>wt=xml&amp;rows=1000000&amp;fl=nid,title&amp;fq=sm_vid_Third_parties_with_which_this_organisation_s_content_can_be_shared:%22Indeed%22</constant>
            </setHeader>
            <to uri="http://172.28.128.158:8983/solr/targetjobs.co.uk.gtimedia.test/select/?"/>

<!--        <split>
                <xpath>//int[@name='nid']</xpath>
            </split>-->
            <convertBodyTo type="java.lang.String" />
        </route>
    </camelContext>
为此:

<to uri="jetty//http://172.28.128.158:8983/solr/targetjobs.co.uk.gtimedia.test/select/?"/>


也没有成功。也许有人知道如何从
jetty
uri
路由到绝对
url

您是否尝试过
bridgeEndpoint
?如下所述:

您的目标url如下所示:

<to uri="jetty//http://172.28.128.158:8983/solr/targetjobs.co.uk.gtimedia.test/select?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"/>

为我工作:

@Override
public void configure() throws Exception {

  restConfiguration()
    .host("localhost")
    .component("jetty")
    .port("8085");

  rest("/api")

    //NEW ROUTE
    .get("/getResidences")
    .produces("application/json")

    //OLD ROUTE
    .to("http://localhost:3000/api/residences?bridgeEndpoint=true&throwExceptionOnFailure=false");

}

请注意rest配置中的.componet(“jetty”)我已经用另一种方式解决了这个问题,但是无论如何,谢谢,我想我将来会需要它,所以我会试试:)你能告诉我你是如何解决问题的吗
@Override
public void configure() throws Exception {

  restConfiguration()
    .host("localhost")
    .component("jetty")
    .port("8085");

  rest("/api")

    //NEW ROUTE
    .get("/getResidences")
    .produces("application/json")

    //OLD ROUTE
    .to("http://localhost:3000/api/residences?bridgeEndpoint=true&throwExceptionOnFailure=false");

}