...
Name | Type | Required | Description |
---|---|---|---|
id | string | yes | The id to reference this configuration |
datasource | yes | A reference to the data source that contains the content | |
table | string | yes | The name of the table that provides the content |
key | string | yes | The name of the column in the table that contains the unique key value |
column | string | yes | The name of the column in the table that contains the content |
contenttype | string | no | The mime type of the content that the column contains |
contenttypecolumn | string | no | The name of the column in the table that contains the mime type |
fallbackurl | string | no | A URL that the response will redirect to if there is no matching record |
acl | ref urn:com.cohga.server.acl#1.0:acl | no | An ACL to apply to the content |
...
If neither
contenttype
orcontenttypecolumn
is provided then “application/octet-stream” will be used.The content is then exposed at /data/blob/<id>/<key>
If
fallbackurl
is not set and there is no row with a matching key then a 404 response will be sent
clob
Properties
Name | Type | Required | Description |
---|---|---|---|
id | string | yes | The id to reference this configuration |
datasource | yes | reference to the data source that contains the content | |
table | string | yes | The name of the table that provides the content |
key | string | yes | The name of the column in the table that contains the unique key value |
column | string | yes | The name of the column in the table that contains the content |
contenttype | string | no | The mime type of the content that the column contains |
contenttypecolumn | string | no | The name of the column in the table that contains the mime type |
fallbackurl | string | no | A URL that the response will redirect to if there is no matching record |
acl | ref urn:com.cohga.server.acl#1.0:acl | no | An ACL to apply to the content |
...
If neither
contenttype
orcontenttypecolumn
is provided then “text/plain” will be used.The content is then exposed at /data/clob/<id>/<key>
If
fallbackurl
is not set and there is no row with a matching key then a 404 response will be sent
Examples
Assuming a postgres table that contains JPEG images in the content column:
Code Block | ||
---|---|---|
| ||
create table blob_test ( pid integer not null, content bytea not null ); create index blob_test_idx on blob_test(prupi); |
Code Block | ||
---|---|---|
| ||
<data:blob id="example" acl="private"> <datasource>postgres</datasource> <table>blob_test</table> <key>pid</key> <column>content</column> <contentType>image<contenttype>image/jpg</contentType>contenttype> <fallbackurl>/resources/images/missing.jpg<fallbackurl> </data:blob> |
The images can then be references using the URL http://weave.hostname/weave/data/blob/example/1234 (assuming there is a row that has the value 1234 in the pid column)
For a data definition you could then reference the column in a parameter with something like:
Code Block | ||||
---|---|---|---|---|
| ||||
<parameter type="url" name="image" label="Image" text="Show" column="{fn concat('data/blob/example/', pid)}"/> |