Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit 463ca4d

Browse files
committed
Merge branch 'rc5'
Conflicts: docs/general.md docs/hosts.md rc4/src/main/java/org/tango/rest/rc4/ClientHelper.java rc4/src/main/java/org/tango/rest/rc4/entities/Attribute.java rc4/src/main/java/org/tango/rest/rc4/entities/AttributeInfo.java rc4/src/main/java/org/tango/rest/rc4/entities/AttributeValue.java rc4/src/main/java/org/tango/rest/rc4/entities/Command.java rc4/src/main/java/org/tango/rest/rc4/entities/CommandInfo.java rc4/src/main/java/org/tango/rest/rc4/entities/CommandResult.java rc4/src/main/java/org/tango/rest/rc4/entities/Device.java rc4/src/main/java/org/tango/rest/rc4/entities/DeviceInfo.java rc4/src/main/java/org/tango/rest/rc4/entities/DeviceState.java rc4/src/main/java/org/tango/rest/rc4/entities/Failure.java rc4/src/main/java/org/tango/rest/rc4/entities/NamedEntity.java rc4/src/main/java/org/tango/rest/rc4/entities/Pipe.java rc4/src/main/java/org/tango/rest/rc4/entities/Property.java rc6/pom.xml
2 parents c3c9d47 + 39a9f3a commit 463ca4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2421
-366
lines changed

docs/device.md

Lines changed: 359 additions & 232 deletions
Large diffs are not rendered by default.

docs/general.md

Lines changed: 86 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ __IMPLEMENTATION NOTE:__ consider integration with TangoAccessControl so that ea
4949
Implementation SHOULD attach a number of links to a particular response. For instance most of the response types may include _self_ link:
5050

5151
```
52-
HTTP response
52+
HTTP 200
5353
5454
Link: <link>; rel="self"
5555
```
@@ -58,11 +58,22 @@ as well as external relationship links:
5858

5959
`GET /tango/rest/rc6/hosts/localhost`
6060
```
61-
HTTP response
61+
HTTP 200
6262
6363
Link: </tango/rest/rc6/hosts>; rel="parent"
6464
```
6565

66+
Or pagination related links:
67+
68+
```
69+
HTTP 206
70+
71+
Link: <http://localhost:10001/tango/rest/rc5/hosts/localhost/devices>; rel="first"; range="0-10"
72+
Link: <http://localhost:10001/tango/rest/rc5/hosts/localhost/devices>; rel="last"; range="31-35"
73+
Link: <http://localhost:10001/tango/rest/rc5/hosts/localhost/devices>; rel="prev"; range="0-10"
74+
Link: <http://localhost:10001/tango/rest/rc5/hosts/localhost/devices>; rel="next"; range="21-30"
75+
```
76+
6677
See [Link header](http://tools.ietf.org/html/rfc5988)
6778

6879
Implementation MUST prefer lower case urls in links e.g. `DevString` (command name) -> `devstring`.
@@ -122,27 +133,84 @@ This one shows everything except _info_ and _properties_ fields:
122133
```
123134

124135

125-
## Pages
136+
## Range
137+
138+
URL | Response | Desc
139+
------------------- | ----------- | ---------------------------------------------------
140+
`GET /{any collection}?range={start}-{end}` | JSONArray | - responses with sub-collection extracted from the original
141+
142+
143+
Implementation MUST include "Accept-Ranges: items" for collection like resources e.g. devices list. Also it MUST include "X-size" response header to indicate how many items are in the collection.
144+
145+
```
146+
GET /hosts/localhost/devices
147+
```
148+
149+
```
150+
Accept-Ranges: items
151+
X-size:26
152+
153+
[...]
154+
```
155+
156+
**NOTE**: we can not use standard _Content-Length_ header here because it is strictly bound to bytes i.e. client may shrink incoming response hence partial JSON and JSONParse exception.
157+
158+
Client includes "Range" header into request to specify the desired range of the collection, while implementation MUST include "Content-Range" header:
159+
160+
```
161+
GET /hosts/localhost/devices?range=10-20
162+
```
163+
164+
```
165+
HTTP 206
166+
Content-Range: items 10-20/26
167+
168+
[...]
169+
```
170+
171+
For instance,
172+
```
173+
GET /hosts/localhost/devices?range=0-25
174+
```
175+
176+
will display only the first 25 devices of a particular Tango host
177+
178+
Implementation MUST respond with **416** in case _Range_ is not satisfiable.
179+
180+
# Cache
181+
182+
Implementation MUST provide _Cache-Control_ headers for Tango resources. Implementation MUST add _max-age-millis_ Cache-Control extension to specify cache delay in millis.
183+
184+
Implementation SHOULD distinguish between fast changing and slow changing values. For instance a list of available devices may be considered as slow changing value and cached for a longer time. Also slow changing values may be cached publicly.
126185

127-
| URL | Response | Desc
128-
|----------------|-----------|---------------------------------------------------
129-
| `GET /{any_collection}?range={range}` | JSONArray | - response contains only required number of resources
186+
Implementation SHOULD export configuration parameters for cache delays and etc
130187

131-
For instance, `GET /devices?range=0-25` will display only the first 25 devices of a particular Tango host
188+
`GET /hosts/localhost/devices`
132189

133-
The implementation MUST return corresponding HTTP headers:
190+
```
191+
HTTP 200
192+
193+
Cache-Control: no-transform, max-age=300, max-age-millis="300000"
194+
Expires: Wed, 21 Nov 2018 11:06:11 GMT
195+
ETag: AC6CB07B377F93434998D8556D60A575
196+
197+
[...]
198+
```
199+
200+
`GET /hosts/localhost/devices/sys/tg_test/1/attributes/double_scalar_ro`
201+
202+
```
203+
HTTP 200
204+
205+
Cache-Control: no-transform, max-age=0, max-age-millis="200"
206+
Expires: Wed, 21 Nov 2018 11:06:11 GMT
207+
ETag: AC6CB07B377F93434998D8556D60A575
208+
209+
[...]
210+
```
134211

135-
HTTP 206 OK
136-
Content-Range: offset – limit / count
137-
offset: index of the first element
138-
limit : index of the last element
139-
count : total number of elements from the collection
140-
Accept-Range: resource and max
141-
resource : type of the element
142-
max : maximum number of element per request
143-
Link: can return several URI to the previous and next range, the first and last range ...
144212

145-
## Errors
213+
# Errors
146214

147215
Any error MUST return status code __400__ (BadRequest). Except few cases: see below.
148216

0 commit comments

Comments
 (0)