Thanks for the idea, but I can't do that. That would make my resources
static and all attachments would be loaded at page load. I did that at the
beginning, and of course that's a very flawed concept because I would run
into huge performance and memory-problems even with just one user.

So I need the ResourceStreamResource to be dynamic. I don't get why the *
getResourceStream()* is called multiple times.. the javadoc for that method
says

Lazy or dynamic initialization (...)


How can I get proper dynamic resource then?

2012/8/17 Sven Meier <[email protected]>

> Beware that ResourceStreamResource#**getResourceStream() is called
> multiple times.
>
> Probably easiest is to create the resource stream in
> CouchDbAttachmentStreamResourc**e's constructor and pass it to super.
>
> Sven
>
>
> On 08/17/2012 05:28 PM, Michael M wrote:
>
>> Hi,
>>
>> I wanted to, but I can't because then I don't have the stream to close it.
>> If I don't close the stream returned by the Ektorp getAttachment() method
>> I
>> will have memory leaks.
>>
>> 2012/8/17 Sven Meier <[email protected]>
>>
>>  Without looking to deep into this you should create the InputStream in
>>> CouchDbResourceStream#****getInputStream() instead of the constructor.
>>>
>>>
>>> Sven
>>>
>>>
>>> On 08/17/2012 04:25 PM, Michael M wrote:
>>>
>>>  Hi, short question this time: I have several ResourceLinks to
>>>> ResourceStreamResources on a page. When I click on one of those links,
>>>> the
>>>> resource streams attachments dynamically out of my database.
>>>>
>>>> That's working quite well now, however the stream (and whatever happens
>>>> in
>>>> the method returning the streams) is called 2-4 times. E.g. opening an
>>>> image results in 4 queries to the CouchDB database. I don't really see
>>>> that
>>>> happening when I'm playing an mp3 file with a flash-player pointing to
>>>> the
>>>> URL of the resource.
>>>>
>>>> Does anyone have an idea why? I'm only instantiating the resource once,
>>>> for
>>>> any link I only use that one resource.
>>>>
>>>> Here's my custom ResourceStreamResource: http://pastebin.com/9BB7LEiV
>>>>
>>>> And here my custom IResouceStream: http://pastebin.com/Z7GvzGja
>>>>
>>>> Thanks!
>>>>
>>>>
>>>>  ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>> <users-unsubscribe@**wicket.apache.org<[email protected]>
>>> >
>>>
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org<[email protected]>
> For additional commands, e-mail: [email protected]
>
>

Reply via email to