I have this problem for now. Though this code works fine:
Node rootNode = session.getRootNode();
Node documentNode = rootNode.getNode("test.txt");
Node contentNode = documentNode.getNode("jcr:content");
InputStream data = contentNode.getProperty("jcr:data").getStream();
"data" - not empty. And when i try do this with version i get empty data
from content node.
I am not understanding what i do wrong.(
travmik wrote:
>
> Thank you for you prompt reply. But method getInStream() in my transfer
> object returns byte[]. In this section it's alright.
> I run my project using jcr-jca on jboss 4.2. Maybe it helps.
> I am confusion.((
>
>
>
> Alexander Klimetschek wrote:
>>
>> The JCR API access looks good. I think the problem lies in the usage
>> of the input stream. For example, ByteArrayInputStream does not take
>> an InputStream as parameter in any of its constructors (it should be a
>> byte[] parameter, but doc2.getInStream() sounds like it returns an
>> InputStream):
>>
>> resNode.setProperty("jcr:data", new
>> ByteArrayInputStream(doc2.getInStream()));
>>
>> Regards,
>> Alex
>>
>> On Mon, Jun 9, 2008 at 4:11 PM, travmik <[EMAIL PROTECTED]> wrote:
>>>
>>> Hi, all
>>> I have very big problem. Can somebody help me?
>>>
>>> I create node:
>>>
>>>
>>> Node rootNode = session.getRootNode();
>>> Node documentNode = rootNode.addNode("test.txt", "nt:file");
>>> Node resNode = contentNode.addNode("jcr:content", "nt:resource");
>>> resNode.setProperty("jcr:mimeType", "text/plain");
>>> resNode.setProperty("jcr:encoding", "UTF8");
>>> resNode.setProperty("jcr:lastModified", System.currentTimeMillis());
>>> resNode.setProperty("jcr:data", new
>>> ByteArrayInputStream(doc1.getInStream()));
>>> documentNode.addMixin("mix:versionable");
>>> session.save();
>>> documentNode.checkin();
>>>
>>>
>>> Then i update node like this:
>>>
>>>
>>> Node documentNode = session.getRootNode().getNode("test.txt");
>>> documentNode.checkout();
>>> Node resNode = contentNode.getNode("jcr:content");
>>> resNode.setProperty("jcr:data", new
>>> ByteArrayInputStream(doc2.getInStream()));
>>> session.save();
>>> documentNode.checkin();
>>>
>>>
>>> And then i try to get data from content node:
>>>
>>>
>>> Node node = session.getRootNode().getNode("test.txt");
>>> VersionHistory hist = node.getVersionHistory();
>>> Version vers = hist.getVersion(versionName);
>>> Node frozenNode= vers.getNode("jcr:frozenNode");
>>> Node versionNode = frozenNode.getNode("jcr:content");
>>> InputStream data = versionNode.getProperty("jcr:data").getStream();
>>>
>>> And all properties are setting up, but property with key "jcr:data" is
>>> empty
>>> for all versions from versionhistory. Why?? What do i do wrong?
>>> Many thanks,
>>> Stas
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Empty-content-from-any-version-tp17733642p17733642.html
>>> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
>>>
>>>
>>
>> --
>> Alexander Klimetschek
>> [EMAIL PROTECTED]
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Empty-content-from-any-version-tp17733642p17748839.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.