English 中文(简体)
如何利用设在贾瓦的无害环境技术网络服务?
原标题:Versioning a Java based REST web service?

似乎正在进行哲学辩论,确切地说,如何建立教育、科学和技术部的网络服务。 不过,对我来说,第一个问题是,在瓦 Java保护区内如何执行和维持,这是一个实际问题。 我的公司正在建造一个新的REE网络服务,虽然我们现在并不关心这一服务的版本,但我不想作出建筑决定,把我们描绘成一个角落。

我猜测,我们现在必须作出的主要决定是,如果我们在我们的国际独立研究所或媒体类型(或两者兼而有)中采用这一版本的识别特征的话。 如果是相关的,我们将只打上几类新的媒体。 申请中还有50+资源URI。

What are the pros and cons of each approach relative to implementing them in our Java servlet?

我的初步想法:

(1) 我赞同对媒体类型(例如“应用/vnd.mystuff+xml;换算=1.0”)的表述,因为它认为XML的表象与SAP/RPC网络服务一样。 而且,似乎只是为了这种事情而设计的。 然而, 似乎很难、甚至不可能做到这一点,因为我们的应用是用域驱动的设计主子制定的,我们只能制造新的 Java版,并且与旧的 classes相坐。 因此,我们必须执行新的 Java课程,然后交出密码JSON/XML序列化/代号,支持所有旧的媒体类型。 我猜测,这与《社会行动计划》的XML Schema版本完全不同。

2) On the other hand, if we were to version the URI s (e.g. "http://ourapp.com/v1/mystuff"), then our customers could deploy two entire versions of the system and stand them up as two separate servlets with different context mappings. However, we d have modify the JPA (ORM) mappings of the v1 Java classes to use the v2 RDBMS schema. This may not always be simple, but I can easily understand how it could be done. This approach bugs me however because "application/vnd.mystuff+xml" will return two different XML models corresponding to two different XML schemas. But maybe it doesn t matter as the client knows what it asked for because it used the v1 or v2 URI...

或者,执行起来比较容易,我们没有考虑的替代办法? 或者,它是否在这个问题的整个问题上unt不?,在后来对此表示担忧?

问题回答

If the restful services are used by mobile applications then it would a bit difficult to bake in the processing of both responses. In my opinion keeping the version in the URL is the better way as this would be easier to decommission the old endpoints when convenient.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签