HTTP form-based remote invocation protocol, implemented by Spring’s HttpInvoker, supported by versions above 2.3.0
.
HTTP short connection, standardized and easy-to-read protocol, easy to connect to external systems, suitable for upper-level business modules.
Starting from Dubbo 3, the Http protocol is no longer embedded in Dubbo, and an independent module needs to be introduced separately.
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-rpc-http</artifactId>
<version>1.0.0</version>
</dependency>
<dubbo:protocol name="http" port="8080" />
<dubbo:protocol ... server="jetty" />
<dubbo:protocol ... server="servlet" />
<servlet>
<servlet-name>dubbo</servlet-name>
<servlet-class>org.apache.dubbo.remoting.http.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dubbo</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
If a servlet is used to dispatch the request
- The protocol port
<dubbo:protocol port="8080" />
must be the same as the port of the servlet container,- The context path of the protocol
<dubbo:protocol contextpath="foo" />
must be the same as the context path of the servlet application.