Mule / jetty setup

I have a working Mule application that I want to configure Jetty to respond to http requests. The following configuration:

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

... works when I launch the application and select the browser for http: // localhost: 8080 - everything that is displayed is "Received" ", for the test: component.

What I want to do is update this so that instead of seeing "Received", I want to go to where I defined the index.html file. My assumption is that I need to modify the test: component for outgoing endpoint - is this correct? Where would I indicate the path (relative or absolute)?

+3
source share
2 answers

:

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

.

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

- addConnector Call jettyConfig.xml Mule .

. :

<jetty:endpoint address="http://localhost:8080" name="serverEndpoint" path="services/Foo" synchronous="false" />
+1

Source: https://habr.com/ru/post/1717775/


All Articles