Mule ESB - Using an Existing Servlet in a Stream

As the name says: (how) is it possible to use an existing Java servlet (an already developed class in a standard java package) in a mule stream? I can't get it to work, as the documentation for this part is pretty thin.

Thanks for the help!

EDIT: I am using the mule built into my tomcat-webapp. I defined several endpoints in the mule-config-war.xml file that tomcat loads. Optimal is the use of these links in an already developed servlet.

Example servlet definition from xml:

<endpoint name="twitter_callbackEndpoint" address="servlet://twitter/callback" exchange-pattern="request-response" responseTimeout="30000" > </endpoint> 

So, how can you create a simple Java-HTTP servlet, reference its @ WebServlet-Url with a link from xml and use it in a mule stream?

+4
source share
1 answer

To get a servlet call in Mule, you need to map the servlet definition in the web.xml file to the dispatcher class from Mule. This is described in Servicing Docs .

 <servlet> <servlet-name>muleServlet</servlet-name> <servlet-class>org.mule.transport.servlet.MuleReceiverServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>muleServlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping> 
0
source

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


All Articles