Add the version parameter to the URL,twitter/google/facebook...is all done this way. Isn't this elegant?twitter/google/facebook...都是这样来做的。这不够优雅吗? 增加版本号就是为了接口能自然过度升级,这必然是需要冗余历史版本的代码。不过做法也有很多种。如果你是在一个应用中实现多版本的支持,那可以直接通过DispatchServlet来做servlet-mapping中即可增加版本号pathIncreasing the version number is so that the interface can be naturally over-upgraded. This must require redundant historical versions of code. But there are many ways to do it. If you are implementing multi-version support in an application, you can directly useDispatchServletto do it. Inservlet-mapping, you can increase the version numberpath. You can also deploy multiple sets ofdifferent versionsapplications on the backend, and forward the interface to different versions of applications for processing based on therequest address.
twitter
https://stream.twitter.com/1.1/statuses/sample.json
google
https://accounts.google.com/o/oauth2/v2/auth
facebook
https://graph.facebook.com/v2.8/oauth/access_token
Add the version parameter to the URL,
twitter/google/facebook...
is all done this way. Isn't this elegant?twitter/google/facebook...
都是这样来做的。这不够优雅吗?增加版本号就是为了接口能自然过度升级,这必然是需要冗余历史版本的代码。不过做法也有很多种。如果你是在一个应用中实现多版本的支持,那可以直接通过
DispatchServlet
来做servlet-mapping
中即可增加版本号path
Increasing the version number is so that the interface can be naturally over-upgraded. This must require redundant historical versions of code. But there are many ways to do it. If you are implementing multi-version support in an application, you can directly useDispatchServlet
to do it. Inservlet-mapping
, you can increase the version numberpath
.You can also deploy multiple sets ofdifferent versionsapplications on the backend, and forward the interface to different versions of applications for processing based on therequest address.