0
votes

I need to move out of mule and jetty/jersey in my web service. I'm looking for a alternative way to implement the current code.

I'm starting the service like this -

org.mule.MuleServer -config deploy_jetty_jersey.xml

deploy_jetty_jersey.xml

http://www.mulesource.org/schema/mule/jetty/2.2 http://www.mulesource.org/schema/mule/jetty/2.2/mule-jetty.xsd http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd http://www.mulesource.org/schema/mule/jersey/2.2 http://www.mulesource.org/schema/mule/jersey/2.2/mule-jersey.xsd http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd">

<jetty:connector name="httpConnector" useContinuations="true"
    configFile="jettyConfig.xml" />
<jetty:endpoint address="http://localhost:8080" name="serverEndpoint"
    path="html" synchronous="false" />

<model name="ServiceSample">
    <service name="testComponent">
        <inbound>
            <jetty:inbound-endpoint ref="serverEndpoint" />
        </inbound>
    </service>

    <service name="restTestHello" initialState="started">
        <inbound>
            <inbound-endpoint address="jersey:http://localhost:7003/rest"
                synchronous="true" />
        </inbound>
        <component>
            <singleton-object class="com.rest.RestResource" />
        </component>
    </service>
</model>

jettyConfig.xml

<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>
                <Item>
                    <New id="StaticHandler" class="org.mortbay.jetty.handler.ResourceHandler" />
                </Item>
                <Item>
                    <New class="org.mortbay.jetty.handler.ContextHandler">
                        <Set name="contextPath">/</Set>
                        <Set name="resourceBase">
                            <SystemProperty name="jetty.home" default="." />
                            XXXXXX
                        </Set>
                        <Call name="addHandler">
                            <Arg>
                                <New class="org.mortbay.jetty.handler.ResourceHandler" />
                            </Arg>
                        </Call>
                    </New>
                </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">XXX</Set>
        </New>
    </Arg>
</Call>

<Set name="stopAtShutdown">true</Set>
<Set name="sendServerVersion">true</Set>
<Set name="sendDateHeader">true</Set>
<Set name="gracefulShutdown">1000</Set>

I need an alternate software which uses similar xml structure, so that there will be minimal java change.

1
Asking open ended questions for recommendations are really not that suitable for stackoverflow. What have you tried? Why is it not working?Joakim Erdfelt
You are using org.mortbay.jetty which is an ancient and long ago EOL (End of Life) version of Jetty. The Jetty project moved to Eclipse about 10 years ago, and is still being maintained on the org.eclipse.jetty namespace. Latest version is 9.4.15.v20190215.Joakim Erdfelt
Also Mule 2.2 is an ancient and obsoleted version.aled

1 Answers

0
votes

The obvious alternative would be to move to a newer Mule version and replace the jetty connector with an HTTP Listener. If you define your REST API with a RAML file you can also use APIKit routing and validation.