How to use the built-in Grizzly server for Mule as well as Jersey

I am currently using the built-in JerseyTest w / Grizzly server to test the code. I am doing a very simple configuration to point to the appropriate resources:

Map<String, String> initParams = new HashMap<String, String>();
initParams.put("com.sun.jersey.config.property.packages", "com.sample.service");
ApplicationDescriptor appDescriptor = new ApplicationDescriptor();
appDescriptor.setServletInitParams(initParams);
super.setupTestEnvironment(appDescriptor);

This works great, and the components of the jersey are available and work as expected.

Now I am trying to add some Mule functions to some of these Jersey calls, but Mule is not initialized / configured correctly by Grizzly. Has anyone got such a setup? What additional configuration do I need to do with JerseyTest / GrizzlyWebServer to get it to properly initialize Mule?

+3
source share
2 answers

, mule Grizzly , , mule :

    DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
    SpringXmlConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder("mule-config.xml");
    muleContext = muleContextFactory.createMuleContext(configBuilder);
    muleContext.start();
+1

, , Mule Jersey. Mule HTTP- ( Grizzly), .

<service name="helloWorldResource">
         <inbound>
            <inbound-endpoint address="jersey:http://localhost:63081/" synchronous="true"/>
         </inbound>
<component class="org.mule.transport.jersey.HelloWorldResource"/>
</service>

http://www.mulesoft.org/display/JERSEY/User 's + Guide

+1

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


All Articles