How, in general, can a web environment support a REST style?

I would like to know in what ways a web framework might be suitable for developing a RESTful application as a whole.

One of the goals is, for example, to provide HTTP request routing, so they are automatically sent to the appropriate controllers. From an architectural point of view, a MVC-based web framework is more suitable for REST.

What other features of web frameworks are useful when creating applications that comply with REST restrictions?

Is there a reason why you are considering some languages โ€‹โ€‹(python / java) or web frameworks (django / turbogears / jersey / restlets / ...) as the most applicable?

+4
source share
5 answers

I think the best way for a web framework to maintain a RESTful style is to automatically match various HTTP verbs ( GET , POST , PUT , DELETE , etc.) with the corresponding methods on its controllers / request handlers. Most modern Python web frameworks do this out of the box, with the exception of Django (unless I missed the dramatic changes).

+1
source

a) You need very flexible routing.
b) You should be able to easily create links that correlate with resource controllers using templates and parameters.
c) The server should help you parse all the http headers. e.g. authorization headers, accept headers, language headers, cookies, etags.
d) It must support serialization and deserialization of all commonly used mime types.
e) This should help analyze parameters from incoming URLs.
f) This should help resolve relative URLs based on the request URL and any BaseURL available.

+1
source

There are several ways the web environment can NOT support REST. Its mostly written using the HTTP model; therefore, almost any web framework works. The automatic routing you mention is a common expectation, but not required for REST.

0
source

I would like to emphasize the ability to directly support the definition of resources. In Ruby on RAils, you can define a resource through scaffolding, and you will get a model with a controller with soothing verbs, implemented also with representations and support for various formats and easily accessible types and routing with identifiers.

In addition to having HTTP access and supporting HTTP principles, this is what you need.

I donโ€™t have enough experience to learn about infrastructure support, but it would be nice to have support for caching and other request parameters.

0
source

In the "software-specific recommendations" section, I recommended Apache CXF people as the basis for building RESTful services with Java. It seems that it is even capable of supporting SOAP at the same time (which is very useful in order to help some of our customers get software). I'm still experimenting with this, so you can do better.

0
source

Source: https://habr.com/ru/post/1310179/


All Articles