質問

JettyをセットアップしてHTTPリクエストに応答する機能するMuleアプリケーションがあります。次の構成:

<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 を選択します。 -test:componentごとに表示されるのは「受信済み」です。

やりたいことは、これを更新して、「受信済み」と表示する代わりに、index.htmlファイルを定義した場所に移動したいことです。私の前提は、発信エンドポイントのtest:component outを変更する必要があるということです-これは正しいですか?パス(相対または絶対)はどこで指定しますか?

役に立ちましたか?

解決

jetty:connectorインスタンスを追加する必要がありました:

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

単純な例にはエラーがあります:

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

他のヒント

これはうまくいきませんでした。

> [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で定義されたポートで1つのインスタンスが作成され、次にMuleで別のインスタンスが作成されます。 jettyConfigでポートを変更すると、2つの異なるポートで同じように動作する2つのインスタンスが生成されます。

最も簡単な解決策は、jettyConfig.xmlからaddConnector呼び出しを削除し、Muleにポートを割り当てることです。

エンドポイントでホストとポートを指定する必要もありません。これで十分です:

<jetty:endpoint address="http://localhost:8080" name="serverEndpoint" path="services/Foo" synchronous="false" />
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top