gpt4 book ai didi

java - 骡子/jetty 设置

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:42:32 26 4
gpt4 key购买 nike

我有一个正在运行的 Mule 应用程序,我想在其上设置 Jetty 以响应 http 请求。以下配置:

<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>

...在我启动应用程序并将选择的浏览器指向 http://localhost:8080 时工作- 根据测试:组件,所有显示的都是“已接收”。

我想做的是更新它,这样我就不会看到“已收到”,而是想转到我定义 index.html 文件的位置。我的假设是我必须更改出站端点的测试:组件 - 这是否正确?我应该在哪里指定路径(相对或绝对)?

最佳答案

我必须添加一个 jetty:connector 实例:

<jetty:connector name="httpConnector" 
configFile="conf/jettyConfig.xml"
useContinuations="true" />

这是 jettyConfig.xml 的内容,因为 simple example有错误:

<?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>

关于java - 骡子/jetty 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1430127/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com