Java Mule/码头设置
我有一个正在工作的Mule应用程序,我想在其上设置Jetty以响应http请求。以下配置:Java Mule/码头设置,java,jetty,mule,Java,Jetty,Mule,我有一个正在工作的Mule应用程序,我想在其上设置Jetty以响应http请求。以下配置: <jetty:endpoint address="http://localhost:8080" name="jettyEndpoint" host="localhost" port="8080" path="/" synchronous="true" />
<jetty:endpoint address="http://localhost:8080"
name="jettyEndpoint"
host="localhost"
port="8080" path="/"
synchronous="true" />
<service name="jettyUMO">
<inbound>
<jetty:inbound-endpoint ref="jettyEndpoint" />
</inbound>
<test:component appendString="Received" />
</service>
…在启动应用程序时起作用,并将选择的浏览器指向-根据test:component,“接收”显示的所有内容
我想做的是更新它,这样就不用看到“Received”,而是转到我定义index.html文件的地方。我的假设是,我必须为出站端点更改test:component-out——这是否正确?在哪里指定路径(相对或绝对)?我必须添加jetty:connector实例:
<jetty:connector name="httpConnector"
configFile="conf/jettyConfig.xml"
useContinuations="true" />
以下是jettyConfig.xml的内容,因为存在错误:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure id="Server" class="org.mortbay.jetty.Server">
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port">8080</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/>
</Item>
<Item>
<New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.deployer.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></Set>
<Set name="webAppDir">path/webapps</Set>
</New>
</Arg>
</Call>
</Configure>
8080
路径/网络应用
这对我不起作用
> [04-22 17:25:22] WARN log [main]:
> failed SelectChannelConnector@0.0.0.0:8080
> java.net.BindException: Address already in use
> at sun.nio.ch.Net.bind(Native Method)
我认为,发生的情况是,一个实例正在jettyConfig中定义的端口上创建,然后通过Mule创建另一个实例。在jettyConfig中更改端口会在两个不同端口上生成两个行为相同的实例
最简单的解决方案是从jettyConfig.xml中删除addConnector调用,并让Mule分配端口
也不需要在端点上指定主机和端口。这就足够了:
<jetty:endpoint address="http://localhost:8080" name="serverEndpoint" path="services/Foo" synchronous="false" />