Good practice to validate two form components hidden deep in component structure

2011-10-01 Thread Per Newgro

Hello everybody,

My environment: Wicket 1.5
My usecase: Validate that payment method cash in advance is only 
accepted for shipping countries (DE, AT, CH).
My rule: No different shipping country - ship to invoice country, 
otherwise ship to shipping country.
My problem: Payment method is a group of radios on payment method panel. 
The shipping country is part of shipping address panel
and the invoice country is part of invoice address panel. The components 
are enclosed in local forms and form component labels.

The compoent structure is deep, but they all share the same root form.

How can i solve this in an elegant way?
Should / Can i use the new event system?
Is it better to use a visitor?
Maybe there is already a blog or example for that?

Would be great if someone could give me a hint.
Thanks
Per


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Good practice to validate two form components hidden deep in component structure

2011-10-01 Thread Martin Makundi
Hi!

In my opinnion, best practice is type safe testing:

https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html

2011/10/1 Per Newgro per.new...@gmx.ch:
 Hello everybody,

 My environment: Wicket 1.5
 My usecase: Validate that payment method cash in advance is only accepted
 for shipping countries (DE, AT, CH).
 My rule: No different shipping country - ship to invoice country, otherwise
 ship to shipping country.
 My problem: Payment method is a group of radios on payment method panel. The
 shipping country is part of shipping address panel
 and the invoice country is part of invoice address panel. The components are
 enclosed in local forms and form component labels.
 The compoent structure is deep, but they all share the same root form.

 How can i solve this in an elegant way?
 Should / Can i use the new event system?
 Is it better to use a visitor?
 Maybe there is already a blog or example for that?

 Would be great if someone could give me a hint.
 Thanks
 Per


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



replace asterix (FormComponentFeedbackBorder)

2011-10-01 Thread Miroslav F.
Hello,

how to replace red asterix in FormComponentFeedbackBorder my own markup?
Is there example?

Any hints would be appreciated. Thanks


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to update a palette?

2011-10-01 Thread Wolfgang Schreiner
Finally solved it:

had a choice renderer

new ChoiceRendererDocumentDto() {
  public Object getDisplayValue(DocumentDto object) {
return object.getDocumentType();
  }
}

which apparently messed things up

changed it to new ChoiceRenderer(documentType, documentId) and 
everything works fine

overriding getIdValue also works!

Have a nice weekend




From:
Wolfgang Schreiner/AUT/CSC@CSC
To:
users@wicket.apache.org
Date:
30.09.2011 13:26
Subject:
Re: How to update a palette?



What do you mean by refresh? I apply setOutputMarkupId on the palette 
and add it to the Ajax request target.

This is how I thought it should work, apparently I missed something ...

final ListModel types = loadChoicesFromDB();
final ListModel selectedTypes = new ListModel(new ArrayList());
final Palette palette = new Palette(palette, selectedTypes, types ... );
palette.setOutputMarkupId(true);
...
final DropDownChoice profiles = ...
profiles.add(new AjaxComponentUpdatingBehavior(onchange) {
  public void onUpdate(AjaxRequestTarget target) {
Integer profileId = profiles.getModelObject().getProfileId();
// selectedTypes.detach();
selectedTypes.setObject(loadSelectedTypesFromDB(profileId));
...
target.add(palette);
  }
});





From:
Duy Do doquoc...@gmail.com
To:
users@wicket.apache.org
Date:
30.09.2011 12:58
Subject:
Re: How to update a palette?



Did you refresh the pallete after chaning its model?

Duy

On Fri, Sep 30, 2011 at 3:03 PM, Wolfgang Schreiner 
wschrei...@csc.comwrote:

 Dear all,

 I need to create a palette which has to be updated on selection changes 
in
 a drop down choice. The drop down choice contains a list of profiles. 
Each
 profile has the same choices but different selected items stored in a
 database. When a user changes the profile selection (Ajax), the palette
 has to show different available and selected choices.

 I am searching for a solution for a while now, and there seem to be a
 number of people having similar issues but I couldn't find a working
 example. The problem is that the selected panel does not update
 correctly (remains empty), although during debugging the model and the
 choices imho contain the correct vales. Removing and adding the 
palette
 from the form doesn't work either. I need to use a palette because the
 order of the items is important!

 Any help is highly appreciated. It's getting pretty frustrating.

 Cheers,

 w




-- 
Duy Do






RE: replace asterix (FormComponentFeedbackBorder)

2011-10-01 Thread Miroslav F.
Finaly I do subclassing with custom markup and it works :-)


 -Original Message-
 From: Miroslav F. [mailto:mir...@seznam.cz] 
 Sent: 01. October 2011 12:06
 To: users@wicket.apache.org
 Subject: replace asterix (FormComponentFeedbackBorder)
 
 Hello,
 
 how to replace red asterix in FormComponentFeedbackBorder my 
 own markup?
 Is there example?
 
 Any hints would be appreciated. Thanks
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to handle errors in RequestCycle.onEndRequest

2011-10-01 Thread Christian Huber

Hi again,

unfortunately my problem still persists. After migrating to 1.5.1 and 
putting my commit code into  onRequestHandlerExecuted() the error 
messages generated there are still not propagated to the rendered 
response page.


But instead I now get the following error message:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!

So it seems that at this it is still to late to anything to the current 
response.


As before the error messages do get displayed after the following request.

At the moment I am totally stumped. Does anyone have a clue what I am 
doing wrong here?


Thanks, Chris


The Sanity Resort http://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian Huberhub...@butterbrot.org  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
database changes in onEndRequest, now if an exception occurs here I do get a
log entry but I cannot get my application to display the corresponding error
to the user.

Adding a message to the feedback panel does not help as the message gets
displayed on the following request but not the current one. I also tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did improve
the situation as far as the request did get aborted but there is still no
visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did not
change anything.

This sounds like a common problem and so I guess there is an easy solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Good practice to validate two form components hidden deep in component structure

2011-10-01 Thread Igor Vaynberg
if you want a truly decoupled way to do this because the components
live in completely different places you can do this:

* override form#onvalidate and send out an event, lets say FormValidateEvent
* the paymentmethod group can listen for this event and when it
receives it it can send out a
ValidatePaymentGroupEvent(getConvertedInput())
* then its just a matter of listening to the VPGE in the correct
country components and calling error() on the right component

-igor

On Sat, Oct 1, 2011 at 12:02 AM, Per Newgro per.new...@gmx.ch wrote:
 Hello everybody,

 My environment: Wicket 1.5
 My usecase: Validate that payment method cash in advance is only accepted
 for shipping countries (DE, AT, CH).
 My rule: No different shipping country - ship to invoice country, otherwise
 ship to shipping country.
 My problem: Payment method is a group of radios on payment method panel. The
 shipping country is part of shipping address panel
 and the invoice country is part of invoice address panel. The components are
 enclosed in local forms and form component labels.
 The compoent structure is deep, but they all share the same root form.

 How can i solve this in an elegant way?
 Should / Can i use the new event system?
 Is it better to use a visitor?
 Maybe there is already a blog or example for that?

 Would be great if someone could give me a hint.
 Thanks
 Per


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to handle errors in RequestCycle.onEndRequest

2011-10-01 Thread Igor Vaynberg
that sounds like a bug, please create a quickstart and attach it to jira.

-igor

On Sat, Oct 1, 2011 at 7:29 AM, Christian Huber hub...@butterbrot.org wrote:
 Hi again,

 unfortunately my problem still persists. After migrating to 1.5.1 and
 putting my commit code into  onRequestHandlerExecuted() the error messages
 generated there are still not propagated to the rendered response page.

 But instead I now get the following error message:

 ERROR - DefaultExceptionMapper     - Unexpected error occurred
 java.lang.IllegalStateException: Header was already written to response!

 So it seems that at this it is still to late to anything to the current
 response.

 As before the error messages do get displayed after the following request.

 At the moment I am totally stumped. Does anyone have a clue what I am doing
 wrong here?

 Thanks, Chris


 The Sanity Resort http://sanityresort.blogspot.com/

 Am 24.09.2011 17:18, schrieb Igor Vaynberg:

 use the onRequestHandlerExecuted() to commit the transaction and
 onException() to roll it back. these are both in
 IRequestCycleListener.

 -igor

 On Mon, Sep 19, 2011 at 10:50 AM, Christian Huberhub...@butterbrot.org
  wrote:

 Hi all,

 I just noticed that exceptions occuring in onEndRequest of a RequestCycle
 somehow do not reflect on the respone page.

 I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
 database changes in onEndRequest, now if an exception occurs here I do
 get a
 log entry but I cannot get my application to display the corresponding
 error
 to the user.

 Adding a message to the feedback panel does not help as the message gets
 displayed on the following request but not the current one. I also tried
 using various AbortExceptions like RedirectToUrlException,
 RestartResponseException or AbortWithWebErrorCodeException. This did
 improve
 the situation as far as the request did get aborted but there is still no
 visual display of the error.

 Setting the ResponsePage directly and/or setting redirect to true did not
 change anything.

 This sounds like a common problem and so I guess there is an easy
 solution
 to it, but I just don't get it right now, so any pointers are welcome.

 Thanks, Chris

 --
 The Sanity Resorthttp://sanityresort.blogspot.com/

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to handle errors in RequestCycle.onEndRequest

2011-10-01 Thread Christian Huber
quickstart created and added to 
https://issues.apache.org/jira/browse/WICKET-4103


this quickstart does not behave exactly like my application but the 
primary problem about messages not being displayed is reproducable. 
please let me know if i can provide any further information and thank 
you for your assitance.



The Sanity Resort http://sanityresort.blogspot.com/

Am 01.10.2011 16:47, schrieb Igor Vaynberg:

that sounds like a bug, please create a quickstart and attach it to jira.

-igor

On Sat, Oct 1, 2011 at 7:29 AM, Christian Huberhub...@butterbrot.org  wrote:

Hi again,

unfortunately my problem still persists. After migrating to 1.5.1 and
putting my commit code into  onRequestHandlerExecuted() the error messages
generated there are still not propagated to the rendered response page.

But instead I now get the following error message:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!

So it seems that at this it is still to late to anything to the current
response.

As before the error messages do get displayed after the following request.

At the moment I am totally stumped. Does anyone have a clue what I am doing
wrong here?

Thanks, Chris


The Sanity Resorthttp://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian Huberhub...@butterbrot.org
  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a RequestCycle
somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus commit my
database changes in onEndRequest, now if an exception occurs here I do
get a
log entry but I cannot get my application to display the corresponding
error
to the user.

Adding a message to the feedback panel does not help as the message gets
displayed on the following request but not the current one. I also tried
using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did
improve
the situation as far as the request did get aborted but there is still no
visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true did not
change anything.

This sounds like a common problem and so I guess there is an easy
solution
to it, but I just don't get it right now, so any pointers are welcome.

Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicketstuffpush 1.5 timepushservice not working

2011-10-01 Thread Attila Király
Fixed a bug related to this in trunk. Will be part of next release (probably
1.5.1). With this change your example worked for me with Chrome and Opera
latest stables. Did not work with FF 7 however so there might be other bugs.

Attila

2011/10/1 vineet semwal vineetsemwal1...@gmail.com

 hellos !

 i have used wicketstuff 1.4.17.2 push before with wicket 1.4.x with
 great success..
 but i cant make wicketstuff 1.5.x push timerpushservice working with
 wicket 1.5.x
 i dont see error or any thing that can help me track something
 useful..,i am attaching a simple quickstart application for the same
 ..


 --
 thank you,

 regards,
 Vineet Semwal


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to handle errors in RequestCycle.onEndRequest

2011-10-01 Thread Christian Huber

Hi Igor,

I just saw you answered to my JIRA issue. I had tried your suggestion 
about throwing an exception before but to no avail (see also my comment 
on the issue):


I had tried adding

throw new RestartResponseException(ErrorPage.class);

to the onrequesthandlerexecuted() callback while ErrorPage is just an 
empty page with empty markup and mounted at error (calling that page 
did work when the exception was not thrown) but that caused the 
following error:


ERROR - DefaultExceptionMapper - Unexpected error occurred
org.apache.wicket.RestartResponseException
ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to response!

throwing the exception directly in the homepage constuctor got me 
redirected to the error page as expected.


would you need a new quickstart for this?


The Sanity Resort http://sanityresort.blogspot.com/

Am 01.10.2011 17:54, schrieb Christian Huber:
quickstart created and added to 
https://issues.apache.org/jira/browse/WICKET-4103


this quickstart does not behave exactly like my application but the 
primary problem about messages not being displayed is reproducable. 
please let me know if i can provide any further information and thank 
you for your assitance.



The Sanity Resort http://sanityresort.blogspot.com/

Am 01.10.2011 16:47, schrieb Igor Vaynberg:
that sounds like a bug, please create a quickstart and attach it to 
jira.


-igor

On Sat, Oct 1, 2011 at 7:29 AM, Christian 
Huberhub...@butterbrot.org  wrote:

Hi again,

unfortunately my problem still persists. After migrating to 1.5.1 and
putting my commit code into  onRequestHandlerExecuted() the error 
messages

generated there are still not propagated to the rendered response page.

But instead I now get the following error message:

ERROR - DefaultExceptionMapper - Unexpected error occurred
java.lang.IllegalStateException: Header was already written to 
response!


So it seems that at this it is still to late to anything to the current
response.

As before the error messages do get displayed after the following 
request.


At the moment I am totally stumped. Does anyone have a clue what I 
am doing

wrong here?

Thanks, Chris


The Sanity Resorthttp://sanityresort.blogspot.com/

Am 24.09.2011 17:18, schrieb Igor Vaynberg:

use the onRequestHandlerExecuted() to commit the transaction and
onException() to roll it back. these are both in
IRequestCycleListener.

-igor

On Mon, Sep 19, 2011 at 10:50 AM, Christian 
Huberhub...@butterbrot.org

  wrote:

Hi all,

I just noticed that exceptions occuring in onEndRequest of a 
RequestCycle

somehow do not reflect on the respone page.

I am using an AjaxFallbackButton and the OSIV pattern and thus 
commit my
database changes in onEndRequest, now if an exception occurs here 
I do

get a
log entry but I cannot get my application to display the 
corresponding

error
to the user.

Adding a message to the feedback panel does not help as the 
message gets
displayed on the following request but not the current one. I also 
tried

using various AbortExceptions like RedirectToUrlException,
RestartResponseException or AbortWithWebErrorCodeException. This did
improve
the situation as far as the request did get aborted but there is 
still no

visual display of the error.

Setting the ResponsePage directly and/or setting redirect to true 
did not

change anything.

This sounds like a common problem and so I guess there is an easy
solution
to it, but I just don't get it right now, so any pointers are 
welcome.


Thanks, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





Ajax : Modifying CallBackUrl in OnEvent()

2011-10-01 Thread Arjun Dhar
Hi,
I have an overridden the
AbstractDefaultAjaxBehavior.getCallbackScript(boolean onlyTargetActivePage)
method.

I have also overridden the AjaxEventBehavior.onEvent().
In the onEvent(AjaxRequestTarget) I want to re-generate the Callback Script
(replace original one with new one), how can I do that. Once generated am
unable to change it using the target object.

thanks.



-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Modifying-CallBackUrl-in-OnEvent-tp3863397p3863397.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Basement Coders Meetup at JavaOne 2011

2011-10-01 Thread Craig Tataryn
Cool, email me when you guys get there and we'll grab some beer. I get there 
tomorrow (Sunday) around noon.

Craig

On 2011-09-20, at 7:47 PM, Don Ferguson don.fergu...@gmail.com wrote:

 Count me in.
 
-Don
 
 On Sep 17, 2011, at 1:15 PM, Igor Vaynberg wrote:
 
 a bunch of people sitting in a bar chatting and drinking beer... :)
 
 -igor
 
 On Fri, Sep 16, 2011 at 4:44 PM, Nelson Segura nsegu...@gmail.com wrote:
 Can you explain how does it work? I am thinking on going to java one
 just to check this out.
 -nelson
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Yet another PageExpiredException question

2011-10-01 Thread bht
Hi Alec,

Wicket 1.5.1 includes an improvement that deals with expired pages
gracefully if they are mapped.

See https://issues.apache.org/jira/browse/WICKET-4014

Regards,

Bernard


On Fri, 30 Sep 2011 15:26:15 -0600, you wrote:

Hello,

I have recently reviewed our application log files and noticed a lot
of PageExpiredException error logs. Here are some of them:

1. PageExpiredException: Cannot find the rendered page in session
[pagemap=null,componentPath=1,versionNumber=0]
2. PageExpiredException: No behaviors attached to component
[MarkupContainer [Component id = mainMenuItemLink]]

We use approach described in this article
http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/C68818AE-E983-4D7A-B6BF-E95CD886BFF2.html
to return the previous response page if it's not null and not equal to
the current page that threw exception. We do this for every exception
that goes throuh WebRequestCycle#onRuntimeException(). Is this a bad
idea?

The page that typically throws these exceptions has no-arg constructor
and constructor that takes PageParameters, which I assume qualifies it
as stateless. When I breakpoint in onAfterRender()
WebPage#isStateless() returns true. But the page has a lot of AJAX
components. Could this be causing PageExpiredExceptions?

Some people on this list recommended creating and returning a new
instance of the page that caused the error. Others, like the article
above, recommend returning the last rendered page.

What's the recommended way to handle PageExpiredExceptions?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Basement Coders Meetup at JavaOne 2011

2011-10-01 Thread Craig Tataryn
No prob, I'm there till Friday. Actually, twitter might be a more reliable way 
to get me than email: @craiger

Craig

On 2011-10-01, at 1:09 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote:

 i wont be there until sunday night.
 
 -igor
 
 On Sat, Oct 1, 2011 at 11:06 AM, Craig Tataryn crai...@tataryn.net wrote:
 Cool, email me when you guys get there and we'll grab some beer. I get there 
 tomorrow (Sunday) around noon.
 
 Craig
 
 On 2011-09-20, at 7:47 PM, Don Ferguson don.fergu...@gmail.com wrote:
 
 Count me in.
 
-Don
 
 On Sep 17, 2011, at 1:15 PM, Igor Vaynberg wrote:
 
 a bunch of people sitting in a bar chatting and drinking beer... :)
 
 -igor
 
 On Fri, Sep 16, 2011 at 4:44 PM, Nelson Segura nsegu...@gmail.com wrote:
 Can you explain how does it work? I am thinking on going to java one
 just to check this out.
 -nelson
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Yet another PageExpiredException question

2011-10-01 Thread Alec Swan
Hello and thank you for a good JIRA resource.

I am using Wicket 1.4.18 and my page is mounted with HybridUrlCodingStrategy.

What can I do to recover from PageExpiredException?

Thanks,

Alec

On Sat, Oct 1, 2011 at 12:43 PM,  b...@actrix.gen.nz wrote:
 Hi Alec,

 Wicket 1.5.1 includes an improvement that deals with expired pages
 gracefully if they are mapped.

 See https://issues.apache.org/jira/browse/WICKET-4014

 Regards,

 Bernard


 On Fri, 30 Sep 2011 15:26:15 -0600, you wrote:

Hello,

I have recently reviewed our application log files and noticed a lot
of PageExpiredException error logs. Here are some of them:

1. PageExpiredException: Cannot find the rendered page in session
[pagemap=null,componentPath=1,versionNumber=0]
2. PageExpiredException: No behaviors attached to component
[MarkupContainer [Component id = mainMenuItemLink]]

We use approach described in this article
http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/C68818AE-E983-4D7A-B6BF-E95CD886BFF2.html
to return the previous response page if it's not null and not equal to
the current page that threw exception. We do this for every exception
that goes throuh WebRequestCycle#onRuntimeException(). Is this a bad
idea?

The page that typically throws these exceptions has no-arg constructor
and constructor that takes PageParameters, which I assume qualifies it
as stateless. When I breakpoint in onAfterRender()
WebPage#isStateless() returns true. But the page has a lot of AJAX
components. Could this be causing PageExpiredExceptions?

Some people on this list recommended creating and returning a new
instance of the page that caused the error. Others, like the article
above, recommend returning the last rendered page.

What's the recommended way to handle PageExpiredExceptions?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Yet another PageExpiredException question

2011-10-01 Thread bht
Alec,

Please download the testcase from the Jira attachment. It contains
workarounds for HybridUrlCodingStrategy and AJAX requests.

Regards,

Bernard 



On Sat, 1 Oct 2011 13:40:10 -0600, you wrote:

Hello and thank you for a good JIRA resource.

I am using Wicket 1.4.18 and my page is mounted with HybridUrlCodingStrategy.

What can I do to recover from PageExpiredException?

Thanks,

Alec

On Sat, Oct 1, 2011 at 12:43 PM,  b...@actrix.gen.nz wrote:
 Hi Alec,

 Wicket 1.5.1 includes an improvement that deals with expired pages
 gracefully if they are mapped.

 See https://issues.apache.org/jira/browse/WICKET-4014

 Regards,

 Bernard


 On Fri, 30 Sep 2011 15:26:15 -0600, you wrote:

Hello,

I have recently reviewed our application log files and noticed a lot
of PageExpiredException error logs. Here are some of them:

1. PageExpiredException: Cannot find the rendered page in session
[pagemap=null,componentPath=1,versionNumber=0]
2. PageExpiredException: No behaviors attached to component
[MarkupContainer [Component id = mainMenuItemLink]]

We use approach described in this article
http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/C68818AE-E983-4D7A-B6BF-E95CD886BFF2.html
to return the previous response page if it's not null and not equal to
the current page that threw exception. We do this for every exception
that goes throuh WebRequestCycle#onRuntimeException(). Is this a bad
idea?

The page that typically throws these exceptions has no-arg constructor
and constructor that takes PageParameters, which I assume qualifies it
as stateless. When I breakpoint in onAfterRender()
WebPage#isStateless() returns true. But the page has a lot of AJAX
components. Could this be causing PageExpiredExceptions?

Some people on this list recommended creating and returning a new
instance of the page that caused the error. Others, like the article
above, recommend returning the last rendered page.

What's the recommended way to handle PageExpiredExceptions?

Thanks,

Alec

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Redirect behaves differently between 1.4.15 and 1.4.18

2011-10-01 Thread bht
Hi Gert-Jan,

I can't comment on your unit test but I have found a similar issue in
1.5.1:

WicketTester does not handle RedirectToUrlException
https://issues.apache.org/jira/browse/WICKET-4104

IMHO in a page constructor, it is preferable to use
ResetResponseException or RedirectToUrlException.

Otherwise there can be unexpected results with setResponsePage where
contents of both pages are interleaved. However I haven't tried this
in onInitialize.

I would recommend to watch the Jira issue. We could learn from the
outcome.

Regards,

Bernard

On Wed, 21 Sep 2011 10:25:38 +0100, you wrote:

Hello all!

As I haven't received a single response yet, even though I created a 
unit test that fails after upgrading to a new version, which seems 
serious to me, I would like to ask you again:

This week we upgraded to Wicket 1.4.18 from 1.4.15 and suddenly, our 
unit tests started failing. It seems that it is caused by the fact that 
redirect behave differently. I have attached a unit test that 
demostrates this. It passes with 1.4.15, but fails with 1.4.18. To spare 
you the effort of unpacking the zip, here's the test class (Note: Page1 
is a simple WebPage that redirects to Page2 in it's onInitialize(), all 
classes are in the zip):

package com.roboreus.geosweep.wicket;

import org.apache.wicket.PageParameters;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.util.tester.WicketTester;
import org.junit.Test;

import static junit.framework.Assert.assertTrue;

public class RedirectTest {

 @Test
 public void testRedirect() throws Exception {

 WicketTester tester = new WicketTester();
 tester.startPage(Page1.class);

 assertTrue(Redirect expected, 
tester.getServletResponse().isRedirect());
 String redirectLocation = 
tester.getServletResponse().getRedirectLocation();
 assertTrue(Expected redirect location, 
!(redirectLocation.isEmpty()));

 String redirectUrl = RequestCycle.get().urlFor(Page2.class, new 
PageParameters()).toString();
 assertTrue(Expected redirect to ' + redirectUrl + ', but 
instead got one to ' + redirectLocation + '.,
redirectLocation.contains(redirectUrl));
 }
}

Do any of you know the cause of this and how to solve it?

Thanks and regards!

Gert-Jan Schouten


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org