简体   繁体   English

REST Web服务与JSON服务

[英]REST web services vs JSON services

REST webservices imply the server-side is stateless (for the most part) and urls correspond to resources and HTTP GET/POST/DELETE/PUT methods correspond to operations on those resources. REST Web服务暗示服务器端(大多数情况下)是无状态的,URL对应于资源,而HTTP GET / POST / DELETE / PUT方法对应于对这些资源的操作。

I am planning to work on a JSON services layer that is dependent on server-side state, having urls that correspond to resources and having urls like /add /update /delete corresponding to different operations and all of those urls using HTTP POST. 我计划在依赖于服务器端状态的JSON服务层上工作,具有与资源相对应的url,并具有与/ add / update / delete之类的URL对应于不同的操作,以及使用HTTP POST的所有这些url。

  1. What is the right terminology for this? 正确的术语是什么? Should this be called JSON web services? 应该将其称为JSON Web服务吗? Is there any specific term for this? 有没有特定的名词?
  2. It looks like Jersey+JAX-RS would be very useful for this purpose. 看起来Jersey + JAX-RS为此非常有用。 Is it ok? 可以吗
  3. Would it make sense to use Struts for this kind of application? 在这种应用程序中使用Struts是否有意义?
  1. JSON is a file format which your rest service may (or may not) use to send its answers. JSON是一种文件格式,您的休息服务可能会(或可能不会)使用JSON发送其答案。 If you use this format to communicate with your webservice, you cann say that your service is a JSON web service. 如果使用此格式与Web服务进行通信,则不能说您的服务是JSON Web服务。
  2. Indeed, Jersey is a good JAX-RS implementation. 确实,Jersey是一个很好的JAX-RS实现。 However it is not the only one. 但是,它不是唯一的。
  3. If you need a webapp to interact with the webservice you can use Struts. 如果您需要一个Web应用程序来与Web服务进行交互,则可以使用Struts。 However, you can use any other tool (included some more recent technology, struts is really old) for the front-end of your system. 但是,您可以为系统前端使用任何其他工具(包括一些较新的技术,struts确实很旧)。

Well, it's not REST. 好吧,它不是REST。 However trying to defeat that tide of general misunderstanding just isn't going to happen. 但是,要克服这种普遍误会的趋势是不会发生的。

What you are describing is actually what most of the world views as REST and therefor should be mostly OK with just calling it as such. 您所描述的实际上是世界上大多数人将其视为REST的观点,因此仅需这样称呼就可以了。

In the presence of a true Restifarian, you will get some push-back because they will be correct - however, there isn't really much need to add a tremendous amount of confusion to your daily life as the distinctions (and the MASSIVE benefits they afford...) are largely lost on anyone you work with. 在真正的Restifarian存在的情况下,您会得到一些回击,因为它们是正确的-但是,确实没有太多需要为您的日常生活增加很多困惑,因为它们之间的区别(以及它们带来的巨大好处)负担得起...)在与您一起工作的任何人上都大失所望。

(1) is accurate enough, or simply rest. (1)足够准确,还是干脆休息。 (2) is redundant but it is a good framework for the technology. (2)是多余的,但它是该技术的良好框架。 (3) I would say no, but noticing when this question was asked, I'm sure you already decided. (3)我会说不,但是请注意,当问到这个问题时,我确定您已经决定了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM