[
https://jira.jboss.org/jira/browse/DNA-513?page=com.atlassian.jira.plugin...
]
Randall Hauch commented on DNA-513:
-----------------------------------
I talked with Brian about this, and perhaps the most challenging aspect of this is knowing
which properties (if any) are encoded in a client PUT/POST request. Either every property
value has to be looked at as possibly being encoded, or there has to be some annotation in
the request defining whether a property value is encoded. The former is expensive and
potentially error prone (e.g., if a string property value is stored already encoded in the
repository, or if a string property coincidentally matches an encoded representation).
The latter approach is less attractive, but is really the only surefire way for the client
and server to know which properties have been encoded in the request and must be decoded
prior to use.
There seem to be two options for annotating the properties: include the annotation in the
name or in the value. Annotating the name is quite straightforward as long as the
annotation includes characters that are not normally allowed in a property name (so we
always know that the annotation is what it is, and not coincidentally part of the property
name). Annotating the value appears on the surface to be pretty easy, but multi-valued
properties and the wider range of values allowed make it more challenging and potentially
more risky.
Therefore, the approach we're going to take is to annotation the property name to
specify that the property value(s) has been encoded. The format will be
"{propertyName}/{encoding}/", where "{propertyName}" is the usual name
of the property, and "{encoding}" is the lowercase name of the encoding that is
used. For example, a "jcr:data" property encoded in Base64 would be represented
in the JSON representations as "jcr:data/base64/". According to the JCR 2.0 PFD
Section 3.2.2, the local name (which applies to property names) can only contain valid
XmlChar except '/' | ':' | '[' | ']' | '|' |
'*' (where the JCR 1.0 spec is a bit more lenient, and it basically says that a
name is not valid if it begins or ends with a '/', ':', '[',
']', '*', ''', '"', '|' or any whitespace
character). Therefore the {propertyName}/{encoding}/" format is never a valid
property name, so can always be used to determine the encoding.
REST server does not correctly encode binary values
---------------------------------------------------
Key: DNA-513
URL:
https://jira.jboss.org/jira/browse/DNA-513
Project: DNA
Issue Type: Bug
Components: Web Application
Affects Versions: 0.5
Reporter: Randall Hauch
Assignee: Brian Carothers
Priority: Blocker
Fix For: 0.6
Attachments: dna-513.1.patch
The REST server (or rather web application) does not properly encode binary values in the
JSON results, and instead is embedding the toString() version of the byte[]. The binary
values should instead be encoded in Base64, and the REST client should be able to then
read (or upload) binary values using this approach.
(If the binary value is already a Base64-encoded representation, then the JSON content
will just be a Base64-encoded representation of the value that happens to be
Base64-encoded. Shouldn't be a problem.)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira