Re: The Apache Software Foundation Announces Apache Wicket™ 6.0.0

2012-09-05 Thread Michael M
Congratulations, and thank you!

2012/9/5 Martijn Dashorst 

> "With great pleasure we announce the availability of Apache Wicket 6.0.0"
> -- Martijn Dashorst, Vice President, Apache Wicket
>
> Apache Wicket v6.0.0 is the 6th major release of the popular open
> source Java web framework. Numerous enhancements make Apache Wicket
> v6.0.0 a solid choice for web development:
>
> - Out-of-the box JQuery integration
> - Complete control over AJAX requests
> - Improved event registration in browsers
> - Support for large datasets in components
> - Dependency management for client side javascript libraries
> - Experimental support for websockets
>
> Additional features include a customizable client-side API, improved
> feedback messages, correct packaging for OSGi compatibility and
> improved initialization of plugins. Highlights include:
>
> Java 6 required -This release moves the minimum required Java version
> to Java 6. This means that Wicket applications running on earlier Java
> versions meaning to upgrade, also need to upgrade their Java runtime.
>
> Revamped Wicket AJAX now leverages JQuery - Wicket's custom AJAX
> JavaScript library has been re-implemented using JQuery. This makes it
> easier to integrate JQuery plugins into Wicket applications. With the
> new AJAX implementation it is possible to provide your own version of
> JQuery should the need arise, or even to replace the whole Wicket
> client side AJAX implementation.
>
> AJAX Attributes - With the new and improved AJAX implementation, you
> can alter any aspect of an AJAX request through AjaxRequestAttributes.
> For example you can specify that the request should be executed using
> POST instead of GET, or that the AJAX request should be multi-part,
> etc. See the migration guide or the JavaDoc of AjaxRequestAttributes
> for all possible options.
>
> Browser event registration replaces inline events - Wicket now uses
> JavaScript event registration instead of inline attributes for AJAX
> components. This enables multiple event listeners to be attached to a
> markup tag, cleans up the rendered markup considerably and reduces the
> amount of generated markup.
>
> IDataProvider now uses long instead of int - The IDataProvider
> interface and implementations now use long instead of int for index
> and size parameters to better line up with the Java Persistence API
> and other persistency frameworks. Big data is now possible with
> Wicket!
>
> ${label} replaces ${input} in feedback messages - Previous Wicket
> versions used the input that was provided by users in error messages
> when validations failed. This led to error messages like "1234a is not
> a valid number". In Wicket 6 the feedback messages use the label of
> the invalid form component instead. You can set the label by calling
> setLabel() on the form component. If no label is provided, Wicket
> defaults to displaying the component identifier. This changes the
> error message to "Phonenumber is not a valid number".
>
> Resources can declare dependencies - It is now much easier to create
> resource contributions with dependencies, for example a JQuery plugin
> can declare a dependency on JQuery and other resources such as
> embedded style sheets. Users of such resources don’t have to provide
> these dependencies themselves, and the dependencies are linked in the
> appropriate order.
>
> Packaged resources will use minimized version automatically - When a
> minimized JavaScript resource is available (filename.min.js – add the
> .min part to the filename before the extension), Wicket will
> automatically use the minimized version when running in deployment
> mode, while using the non-minimized version for development mode.
>
> OSGi compatible packaging - Wicket's packaging has been made
> compatible with OSGi bundles by moving some classes to different
> packages. The full list can be found in our migration guide. This
> makes it much easier to deploy Wicket applications in an OSGi
> environment.
>
> Experimental websocket implementations - This release also includes
> two experimental websocket implementations: one using Atmosphere as a
> bridge for browsers and containers that don't support websockets
> natively and one for containers and browsers that have native
> websocket support.
>
> The complete set of changes is available in the migration guide at
> http://s.apache.org/wicket-6.0-migration
>
> Availability and Oversight
>
> As with all Apache products, Apache Wicket v6.0.0 is released under
> the Apache License v2.0, and is overseen by a self-selected team of
> active contributors to the project. A Project Management Committee
> (PMC) guides the Project's day-to-day operations, including community
> development and product releases. Apache Wicket source code,
> documentation, and related resources are available at
> http://wicket.apache.org/
>
> "Apache", "Wicket", "Apache Wicket", and "ApacheCon" are trademarks of
> The Apache Software Foundation. All other brands and trademarks are

Re: i18n/l10n XML file not recognized in Wicket 6.0.0-beta3?

2012-08-24 Thread Michael M
Oh boy.. I somehow assumed that .properties is the file-extension for the
normal properties files, and .xml for XML files. So I overlooked the proper
naming-conventions.. sigh.

Thanks, woking now!

2012/8/24 Sven Meier 

> Do your files have the correct suffix?
>
> *.properties.xml
>
> Sven
>
> Michael M  schrieb:
>
> >Hi, need to use an XML file for localization in my application. However,
> >Wicket is just not recognizing an XML file for this.
> >
> >I did the XML structure exactly like in the examples, proper UTF-8
> >encoding, proper doctype for Java properties. I copied the examples into a
> >newly created UTF-8 text file and saved it as an XML, I tried to do it
> from
> >scratch in a text-editor as well as in my IDE. I escaped the {} brackets
> >with a backslash, tried without any text or just one letter in the
> >-tags... nothing, Wicket is not recognizing or not reading the file.
> >
> >XML validators tell me the file is valid. As soon as I change the XML into
> >a .properties file, Wicket reads it. But I need UTF-8 for German Umlauts.
> >
> >Is the beta3 having a problem maybe, anyone else experiencing that?
> >*_de.html files are recognized as well, but not my XML.
>


i18n/l10n XML file not recognized in Wicket 6.0.0-beta3?

2012-08-24 Thread Michael M
Hi, need to use an XML file for localization in my application. However,
Wicket is just not recognizing an XML file for this.

I did the XML structure exactly like in the examples, proper UTF-8
encoding, proper doctype for Java properties. I copied the examples into a
newly created UTF-8 text file and saved it as an XML, I tried to do it from
scratch in a text-editor as well as in my IDE. I escaped the {} brackets
with a backslash, tried without any text or just one letter in the
-tags... nothing, Wicket is not recognizing or not reading the file.

XML validators tell me the file is valid. As soon as I change the XML into
a .properties file, Wicket reads it. But I need UTF-8 for German Umlauts.

Is the beta3 having a problem maybe, anyone else experiencing that?
*_de.html files are recognized as well, but not my XML.


Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Michael M
Hmm, that would require quite a rewrite, unfortunately I can't afford that
time-effort right now (I chose Wicket for my thesis project). I'm not even
sure if I could do that, because in some cases I also need the URL from the
ResourceLink (e.g. to pass it to JW Player JavaScript for playing an
'audio' content-type attachment from the DB).

IMHO, making this possible is also the whole point of having dynamic
resources.

I'll see if I can file that as a bug. Until then I think I just have to
ignore the stream-resource behavior, since it's not really noticeable in
the prototype yet.

Thanks for your help up to this point! If anyone has more suggestions, feel
free please. :)

2012/8/17 Sven Meier 

> Hm, possibly easiest would be to create the resource when it is requested
> only.
> What component are you using to integrate the resource in your page?
>
>
> >Is it possible that it's a bug that the stream gets requested multiple
> times? Or if it is by design, why?
>
> IMHO ResourceStreamResource#**internalGetResourceStream() should check
> for an already created stream and return that one. The way it is
> implemented now looks like a bug.
>
> Sven
>
>
>
> On 08/17/2012 06:19 PM, Michael M wrote:
>
>> Is it possible that it's a bug that the stream gets requested multiple
>> times? Or if it is by design, why? I can't see a reason for it.
>>
>> I also cannot only return a new IResourceStream when it's not instantiated
>> yet in my ResourceStreamResource, because the AttachmentInputStream from
>> Ektorp is not serializable, I get errors if I try that. As far as my
>> knowledge goes I see myself with no option left..
>>
>> 2012/8/17 Michael M 
>>
>>  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 
>>>
>>>  Beware that ResourceStreamResource#getResourceStream() is called
>>>>
>>>> multiple times.
>>>>
>>>> Probably easiest is to create the resource stream in
>>>> CouchDbAttachmentStreamResource'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 
>>>>>
>>>>>   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
>>>>>>>

Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Michael M
Is it possible that it's a bug that the stream gets requested multiple
times? Or if it is by design, why? I can't see a reason for it.

I also cannot only return a new IResourceStream when it's not instantiated
yet in my ResourceStreamResource, because the AttachmentInputStream from
Ektorp is not serializable, I get errors if I try that. As far as my
knowledge goes I see myself with no option left..

2012/8/17 Michael M 

> 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 
>
>> 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 
>>>
>>>  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>
>>>> 
>>>> >
>>>>
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>>
>>
>> --**--**-
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>


Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Michael M
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 

> 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 
>>
>>  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>
>>> 
>>> >
>>>
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: ResourceStreamResources stream multiple times when ResourceLink clicked once

2012-08-17 Thread Michael M
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 

> 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.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Michael M
Ok I think I got it now! Simply using a ResourceStreamResource instead of a
ByteArrayResource, duh... I think the reason why I just couldn't see clear
before is all the different obsolete examples and tutorials for older
versions. The problem is, when you are new to Wicket, you are still
figuring out how stuff works, and when trying to implement certain things
you hit road-blocks because those code-examples don't work anymore, and you
don't know why.

Here is my solution: http://pastebin.com/yQFh5gk8

This is how I'm doing it for now, returning the stream on-the-fly from the
database when the ResourceLink is clicked.

However, I get huge stacks of exceptions now: *java.lang.IllegalStateException:
Header was already written to the resonse!*
*
*
Here is an example, I get lots of those: http://pastebin.com/5LuDqp5a

Thanks! I'm almost there I think :)

2012/8/16 Michael M 

> I think I just made a huge step forward by overriding getData() of
> ByteArrayResource. I've read that in the documentation before, but at that
> time was too deep into the concept of resources that I didn't get it (I'm
> completely new to Wicket).
>
> So, right now it works that I read my attachment, convert it into a
> byte-array and deliver it, only when the link is clicked. I still get a URL
> I can use for other functions (pass a .mp4-ByteArrayResource to a JW Player
> instance e.g.) No creating of static resources at page-load anymore.
>
> Next step would be to skip the byte-array completely. How could I do my
> own Resource that delivers the data as a stream, but has the same
> functionality otherwise (usable in some kind of Link so that I can get the
> URL)? Something like
>
> Resource attachmentResource = new WebResource() {
>> @Override
>> public IResourceStream getResourceStream() {
>> // return my stream somehow
>>  }
>> }
>
>
> doesn't work anymore if I'm not mistaken.
>
> Appreciate your help so far!
>
> 2012/8/16 Michael M 
>
>> Hi, thanks for for quick answer! I already played around with
>> ResourceStreams, but my problem was that I couldn't do the bridge from a
>> Stream to a Resource with a URL.
>>
>> I should add, I'm not offering my ByteArrayResources as a download. I
>> pass the content-type and filename, and (with the help I got from a user
>> here) return it as INLINE. So, when the user clicks, the browser opens the
>> filetype if it can (e.g. a picture, or a PDF with a built-in viewer).
>>
>> Also (and that's important) I then have a real URL which I can pass to
>> Javascript functions. E.g. if the attachment is an mp3 or a video, I
>> additionally use the URL of the ResourceLink to open a custom flash-player
>> (JW Player).. I need a solid URL for that, for that session.
>>
>> When I played around I just couldn't manage to get that kind of URL when
>> I worked with Streams. But I will give it another try.
>>
>> PS: I found this example a while ago, and wanted to implement my own
>> IResourceStream to fetch the attachments from the DB, but the example is
>> outdated and I couldn't figure out how to do it with a newer version of
>> Wicket: http://goo.gl/imGrl
>>
>>
>> 2012/8/16 Sven Meier 
>>
>>> Take a look at DownloadLink and FileResourceStream, and replace all File
>>> related API to your CouchDB access.
>>>
>>> Sven
>>>
>>> Michael M  schrieb:
>>>
>>> >Hi, in my project I use a CouchDB with files as attachments. Currently I
>>> >have a page that makes those attachments available via a ResourceLink.
>>> What
>>> >I do when creating that page is:
>>> >
>>> >   - I read all attachments (I get them as an InputStream),
>>> >   - create a byte[] out of it,
>>> >   - create a static Wicket ByteArrayResource
>>> >   - and put the link to that resource on the page.
>>> >
>>> >That works for smaller files, but a huge problem is of course: it's
>>> static,
>>> >and I get memory problems if the attachments get too big. Also,
>>> currently
>>> >obviously each session does this.
>>> >
>>> >What I would like to do instead is:
>>> >
>>> >   - create Resources that will load my attachments dynamically if the
>>> link
>>> >   is clicked,
>>> >   - and add ResourceLinks to those resources on my page instead.
>>> >   - If possible, maybe deliver the attachments directly from the
>>> >   InputStream my CouchDB delivers, so I don't have to have any static
>>> >   byte-arrays on my server.
>>> >
>>> >That way I could make the page load immediately and deliver attachments
>>> >only if required.
>>> >
>>> >I've wrapped my head around IResourceStreams, but I just can't see clear
>>> >anymore and am confused about how to create those dynamic resources
>>> (also
>>> >because some old examples don't work anymore with Wicket 1.5 or 6beta3).
>>> >
>>> >I'd be very thankful for a short example, or a hint about how to design
>>> >this. Thank you!
>>>
>>
>>
>


Re: Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Michael M
I think I just made a huge step forward by overriding getData() of
ByteArrayResource. I've read that in the documentation before, but at that
time was too deep into the concept of resources that I didn't get it (I'm
completely new to Wicket).

So, right now it works that I read my attachment, convert it into a
byte-array and deliver it, only when the link is clicked. I still get a URL
I can use for other functions (pass a .mp4-ByteArrayResource to a JW Player
instance e.g.) No creating of static resources at page-load anymore.

Next step would be to skip the byte-array completely. How could I do my own
Resource that delivers the data as a stream, but has the same functionality
otherwise (usable in some kind of Link so that I can get the URL)?
Something like

Resource attachmentResource = new WebResource() {
> @Override
> public IResourceStream getResourceStream() {
> // return my stream somehow
> }
> }


doesn't work anymore if I'm not mistaken.

Appreciate your help so far!

2012/8/16 Michael M 

> Hi, thanks for for quick answer! I already played around with
> ResourceStreams, but my problem was that I couldn't do the bridge from a
> Stream to a Resource with a URL.
>
> I should add, I'm not offering my ByteArrayResources as a download. I pass
> the content-type and filename, and (with the help I got from a user here)
> return it as INLINE. So, when the user clicks, the browser opens the
> filetype if it can (e.g. a picture, or a PDF with a built-in viewer).
>
> Also (and that's important) I then have a real URL which I can pass to
> Javascript functions. E.g. if the attachment is an mp3 or a video, I
> additionally use the URL of the ResourceLink to open a custom flash-player
> (JW Player).. I need a solid URL for that, for that session.
>
> When I played around I just couldn't manage to get that kind of URL when I
> worked with Streams. But I will give it another try.
>
> PS: I found this example a while ago, and wanted to implement my own
> IResourceStream to fetch the attachments from the DB, but the example is
> outdated and I couldn't figure out how to do it with a newer version of
> Wicket: http://goo.gl/imGrl
>
>
> 2012/8/16 Sven Meier 
>
>> Take a look at DownloadLink and FileResourceStream, and replace all File
>> related API to your CouchDB access.
>>
>> Sven
>>
>> Michael M  schrieb:
>>
>> >Hi, in my project I use a CouchDB with files as attachments. Currently I
>> >have a page that makes those attachments available via a ResourceLink.
>> What
>> >I do when creating that page is:
>> >
>> >   - I read all attachments (I get them as an InputStream),
>> >   - create a byte[] out of it,
>> >   - create a static Wicket ByteArrayResource
>> >   - and put the link to that resource on the page.
>> >
>> >That works for smaller files, but a huge problem is of course: it's
>> static,
>> >and I get memory problems if the attachments get too big. Also, currently
>> >obviously each session does this.
>> >
>> >What I would like to do instead is:
>> >
>> >   - create Resources that will load my attachments dynamically if the
>> link
>> >   is clicked,
>> >   - and add ResourceLinks to those resources on my page instead.
>> >   - If possible, maybe deliver the attachments directly from the
>> >   InputStream my CouchDB delivers, so I don't have to have any static
>> >   byte-arrays on my server.
>> >
>> >That way I could make the page load immediately and deliver attachments
>> >only if required.
>> >
>> >I've wrapped my head around IResourceStreams, but I just can't see clear
>> >anymore and am confused about how to create those dynamic resources (also
>> >because some old examples don't work anymore with Wicket 1.5 or 6beta3).
>> >
>> >I'd be very thankful for a short example, or a hint about how to design
>> >this. Thank you!
>>
>
>


Re: Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Michael M
Hi, thanks for for quick answer! I already played around with
ResourceStreams, but my problem was that I couldn't do the bridge from a
Stream to a Resource with a URL.

I should add, I'm not offering my ByteArrayResources as a download. I pass
the content-type and filename, and (with the help I got from a user here)
return it as INLINE. So, when the user clicks, the browser opens the
filetype if it can (e.g. a picture, or a PDF with a built-in viewer).

Also (and that's important) I then have a real URL which I can pass to
Javascript functions. E.g. if the attachment is an mp3 or a video, I
additionally use the URL of the ResourceLink to open a custom flash-player
(JW Player).. I need a solid URL for that, for that session.

When I played around I just couldn't manage to get that kind of URL when I
worked with Streams. But I will give it another try.

PS: I found this example a while ago, and wanted to implement my own
IResourceStream to fetch the attachments from the DB, but the example is
outdated and I couldn't figure out how to do it with a newer version of
Wicket: http://goo.gl/imGrl

2012/8/16 Sven Meier 

> Take a look at DownloadLink and FileResourceStream, and replace all File
> related API to your CouchDB access.
>
> Sven
>
> Michael M  schrieb:
>
> >Hi, in my project I use a CouchDB with files as attachments. Currently I
> >have a page that makes those attachments available via a ResourceLink.
> What
> >I do when creating that page is:
> >
> >   - I read all attachments (I get them as an InputStream),
> >   - create a byte[] out of it,
> >   - create a static Wicket ByteArrayResource
> >   - and put the link to that resource on the page.
> >
> >That works for smaller files, but a huge problem is of course: it's
> static,
> >and I get memory problems if the attachments get too big. Also, currently
> >obviously each session does this.
> >
> >What I would like to do instead is:
> >
> >   - create Resources that will load my attachments dynamically if the
> link
> >   is clicked,
> >   - and add ResourceLinks to those resources on my page instead.
> >   - If possible, maybe deliver the attachments directly from the
> >   InputStream my CouchDB delivers, so I don't have to have any static
> >   byte-arrays on my server.
> >
> >That way I could make the page load immediately and deliver attachments
> >only if required.
> >
> >I've wrapped my head around IResourceStreams, but I just can't see clear
> >anymore and am confused about how to create those dynamic resources (also
> >because some old examples don't work anymore with Wicket 1.5 or 6beta3).
> >
> >I'd be very thankful for a short example, or a hint about how to design
> >this. Thank you!
>


Need some help creating dynamic resources from database-inputstream please!

2012-08-16 Thread Michael M
Hi, in my project I use a CouchDB with files as attachments. Currently I
have a page that makes those attachments available via a ResourceLink. What
I do when creating that page is:

   - I read all attachments (I get them as an InputStream),
   - create a byte[] out of it,
   - create a static Wicket ByteArrayResource
   - and put the link to that resource on the page.

That works for smaller files, but a huge problem is of course: it's static,
and I get memory problems if the attachments get too big. Also, currently
obviously each session does this.

What I would like to do instead is:

   - create Resources that will load my attachments dynamically if the link
   is clicked,
   - and add ResourceLinks to those resources on my page instead.
   - If possible, maybe deliver the attachments directly from the
   InputStream my CouchDB delivers, so I don't have to have any static
   byte-arrays on my server.

That way I could make the page load immediately and deliver attachments
only if required.

I've wrapped my head around IResourceStreams, but I just can't see clear
anymore and am confused about how to create those dynamic resources (also
because some old examples don't work anymore with Wicket 1.5 or 6beta3).

I'd be very thankful for a short example, or a hint about how to design
this. Thank you!


Re: Using Jasypt for URL encryption not working (Wicket 1.5.7)

2012-08-13 Thread Michael M
Hi,

I tried that, however I'm not familiar enough with the URL encryption
procedure to find the error. Also, the Jasypt exception is very general due
to security reasons. Here's a link to the FAQ:
http://www.jasypt.org/faq.html#i-keep-on-receiving-encryption-operation-not-possible

I've uploaded a quick start: http://d.pr/f/vZzv

On start you should already see the exceptions, and an error when clicking
on the link for the second page. I guess more people will run into this,
because Wicket documentation points to Jasypt for a more secure URL
encryption, and I followed their directions. Maybe someone is more capable
than me in finding the error. It might be a Jasypt problem after all
because of the newest 1.5.7 Wicket version, I don't know. But then maybe
Wicket shouldn't link to Jasypt for this anymore?

Thanks, if anyone finds the time to look into it. :)

2012/8/12 Martin Grigorov 

> Hi,
>
> Put breakpoints in CryptoMapper's methods for encrypting and
> decrypting and see what's wrong.
>
> On Sat, Aug 11, 2012 at 11:41 AM, Michael M  wrote:
> > Hi, short question: I'm trying to use Jasypt to encrypt my non-mounted
> > URLs. However, it doesn't seem to work, I get exceptions.
> >
> > After adding the dependency (jasypt-wicket15) I set up the Jasypt Crypt
> > Factory as in the example on their site:
> http://www.jasypt.org/wicket.html
> >
> > (...)
> > getSecuritySettings().setCryptFactory(jasyptCryptFactory);
> >
> >
> > The 'Configuring URL encryption' section seems to be outdated though, as
> > far as I know this has to be done now by setting putting this in my
> > application init-method, instead of using the RequestCycleProcessor:
> >
> > setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));
> >
> >
> > If I use this line alone (without Jasypt) it works using the built-in
> > encryption. However with the Jasypt factory I get the rolling errors, and
> > my site doesn't work properly anymore:
> >
> > CryptoMapper: Error decrypting URL
> > org.jasypt.exceptions.EncryptionOperationNotPossibleException: null
> >
> > (See the full exception here: http://pastebin.com/5HgYD2hx)
> >
> > Am I doing something wrong with the new *setRootRequestMapper*, or is
> > Jasypt just not working anymore with 1.5.7? Thanks!
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Using Jasypt for URL encryption not working (Wicket 1.5.7)

2012-08-11 Thread Michael M
Hi, short question: I'm trying to use Jasypt to encrypt my non-mounted
URLs. However, it doesn't seem to work, I get exceptions.

After adding the dependency (jasypt-wicket15) I set up the Jasypt Crypt
Factory as in the example on their site: http://www.jasypt.org/wicket.html

(...)
getSecuritySettings().setCryptFactory(jasyptCryptFactory);


The 'Configuring URL encryption' section seems to be outdated though, as
far as I know this has to be done now by setting putting this in my
application init-method, instead of using the RequestCycleProcessor:

setRootRequestMapper(new CryptoMapper(getRootRequestMapper(), this));


If I use this line alone (without Jasypt) it works using the built-in
encryption. However with the Jasypt factory I get the rolling errors, and
my site doesn't work properly anymore:

CryptoMapper: Error decrypting URL
org.jasypt.exceptions.EncryptionOperationNotPossibleException: null

(See the full exception here: http://pastebin.com/5HgYD2hx)

Am I doing something wrong with the new *setRootRequestMapper*, or is
Jasypt just not working anymore with 1.5.7? Thanks!


Re: Javascript in HTML -ta not working when Panel is used within a Wicket ModalWindow

2012-08-09 Thread Michael M
That really is working! I don't get it, I've seen that nowhere documented,
so I guess it's more a problem of SyntaxHighlighter than Wicket at all (in
combination with Ajax).

Thanks for your help, I appreciate it! I guess if everything is working as
expected with JavaScript inside panels I also won't have trouble with other
content.

2012/8/9 Andrea Del Bene 

> On 08/09/2012 04:20 PM, Michael M wrote:
>
>> Hmm I really just tried this several times.. how can it be that different
>> people get a different quick-start behavior? I created that quick start
>> form scratch, added the wicket-extensions dependency, my classes, the
>> 'media' folder with all the CSS and JS files and ran it. I'm confused..
>>
>> 2012/8/9 Michael M 
>>
>>
>>  The different behavior should be due to a different version of Jetty:
> inside Eclipse I was using ver 6.1.26 while running your quickstart via
> Maven it uses ver 7.5 and I get your behavior.
> That said, I've found a solution replacing all() with highlight() (see
> here: http://stackoverflow.com/**questions/6471526/use-syntax-**
> highlighter-on-ajax-loaded-**content<http://stackoverflow.com/questions/6471526/use-syntax-highlighter-on-ajax-loaded-content>).
> I'm not an expert of Syntax Highlighterlibrary, so I can't say why
> highlight() works while all() doesn't...
>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>