servlet也是RPC的一种吗?

Is servlet also a kind of RPC?

据我了解,RPC 是一种客户端-服务器模型,客户端向服务器端发送一些请求并返回一些结果。那么,Javaservlet是不是也是一种使用HTTP协议的RPC呢?我说得对吗?

这是 RPC 上 wikipedia article 的第一句话:

In computer science, a remote procedure call (RPC) is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction.1 That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote.

因此,如果您可以使用

从客户端调用 servlet,那么 Servlet 将是一种 RPC 机制
SomeResult r = someObject.doSomething();

完全不是这样。要调用 servlet,您需要明确发送 HTTP 请求并以 servlet 期望的方式对参数进行编码,然后读取并解析响应。