Hello,
I am having trouble getting identifier from a Response to a request.
In my resource class, I create a JsonRepresentation and identifier is
set like this :
result.setIdentifier(getRequest().getResourceRef().getIdentifier() +
profileId);
(where profileId is the id of a profile created by this resource).
in my junit test, I do the following :
Response response = client.handle(request);
JsonRepresentation jsonRep = new JsonRepresentation(response.getEntity());
jobj = jsonRep.getJsonObject();
String createdId = jobj.getString(profile created);
Reference createdProfile = jsonRep.getIdentifier() // return null;
Representation entity = response.getEntity();
createdProfile = entity.getIdentifier(); // return the expected reference
Using eclipse to debug my test and inspect object, I can see that
identifier field is
null in my JsonRepresentation object, but not inside the
wrappedRepresentation.
Same for the Response object.
I'm using a 2.0 Snapshot (build 859).
Is my way to handle response and to follow created content correct ?
Thanks for any help,
Laurent.
P.S. here is a copy/paste from eclipse debug view of my object, if this
can help understand what I'm saying.
jsonRep= JsonRepresentation (id=80)
UNKNOWN_SIZE= -1
available= true
characterSet= null
digest= null
downloadable= false
downloadName= null
encodings= Variant$1 (id=86)
expirationDate= null
identifier= null
indent= false
indentSize= 0
isTransient= false
jsonObject= null
available= true
characterSet= null
digest= null
downloadable= false
downloadName= null
encodings= null
expirationDate= null
identifier= null
isTransient= false
languages= null
log= Logger (id=97)
mediaType= null
modificationDate= null
range= null
size= -1
socket= Socket (id=99)
tag= null
wrappedRepresentation= InputRepresentation (id=101)
available= false
characterSet= CharacterSet (id=105)
digest= null
downloadable= false
downloadName= null
encodings= Variant$1 (id=106)
expirationDate= null
identifier= Reference (id=107)
isTransient= true
languages= Variant$2 (id=108)
mediaType= MediaType (id=93)
modificationDate= null
range= null
size= -1
stream= null
tag= null
jsonRepresentation= StreamClientCall$SocketWrapperRepresentation
(id=65)
languages= Variant$2 (id=91)
mediaType= MediaType (id=93)
modificationDate= null
range= null
size= -1
response= Response (id=51)
CURRENT= ThreadLocalT (id=120)
allowedMethods= null
attributes= TreeMapK,V (id=55)
challengeRequests= null
cookieSettings= null
dimensions= CopyOnWriteArraySetE (id=63)
al= CopyOnWriteArrayListE (id=122)
characterSet= null
digest= null
downloadable= false
downloadName= null
encodings= null
expirationDate= null
identifier= null
isTransient= false
languages= null
log= Logger (id=97)
mediaType= null
modificationDate= null
range= null
size= -1
socket= Socket (id=99)
tag= null
wrappedRepresentation= InputRepresentation (id=101)
available= false
characterSet= CharacterSet (id=105)
digest= null
downloadable= false
downloadName= null
encodings= Variant$1 (id=106)
expirationDate= null
identifier= Reference (id=107)
isTransient= true
languages= Variant$2 (id=108)
mediaType= MediaType (id=93)