开发者

Java EE Web Applications vs Web Services

开发者 https://www.devze.com 2023-02-03 10:06 出处:网络
Can someone confirm or clarify for me: From what I can tell, Java EE web apps consist of a Servlet and/or JSP driven dynamic web page being fed back in the HTTP response, triggered by the Java EE ser

Can someone confirm or clarify for me:

From what I can tell, Java EE web apps consist of a Servlet and/or JSP driven dynamic web page being fed back in the HTTP response, triggered by the Java EE server receiving a HTTP GET or POST request.

From what I can tell, Java EE web services also make use of Servlets as the web tier components, however a WS Servlet receives a SOAP message and validates the contents of those messages with whatever WSDL the Servlet is WARed with. The response is also packaged in SOAP and sent back to the requestor.

So, from what I can tell, both Java EE web apps and WSes use Servlets as the web components, with the only real difference being the protocol used (raw HTTP vs SOAP, which 开发者_开发百科is an extension of HTTP).

This is the best I could come up with - am I right? Totally wrong? Close?


The biggest difference is not in how they are delivered, but in how they are used. Web applications are targeted to web browsers and usually serve full HTML-based applications . Web services, on the other hand, are purposed to serve raw data for another application to consume.


You are right, and servlets are just a means to connect the code at a given webapp context to a URI path. Whether the servlet is serving HTML or WS is inconsequential to the webapp container, it's just data with a MIME type being sent back.

You could also manage the same thing with a filter under Servlet 2.3 and later specifications. Spring does this, and has a very robust means of adding to the filter chain to support it.

0

精彩评论

暂无评论...
验证码 换一张
取 消