You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dale Ogilvie <Da...@trimble.com> on 2012/05/29 23:52:13 UTC

Specified expiration page not being shown

Hi,

This is for wicket 1.4.20.

In our WebApplication subclass we have used:

getApplicationSettings().setPageExpiredErrorPage(MyExpiredPage.class);

However after session has expired on one of our pages, if I submit the
(fairly complex) form, the form error message is shown. By this I mean
that page component validation fires and validation of an object from
session (now defunct) fails and the page is redrawn with an error
message in the feedback panel. The expired page IS displayed if an ajax
backed combo is used on the same form, only form submission avoids the
expiry page.

Why might it be that our MyExpiredPage is not being shown in the form
submission case? We want our expired page to be displayed consistently. 

Thanks for any suggestions as to where to look for the issue.

Dale



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


RE: Specified expiration page not being shown

Posted by Dale Ogilvie <Da...@trimble.com>.
After more investigation it seems that wicket 1.4.20 is not always
displaying the expired page if session expires on a form and the form
button link resolves to a url mounted using QueryStringUrlCodingStrategy

        mount(new QueryStringUrlCodingStrategy("test",HomePage.class));

the relevant bit of code in WebRequestCycleProcessor is below,
requestCodingStrategy will return a target if path is not null, even if
session is dead.

// NOTE we are doing the mount check as the last item, so that it will
// only be executed when everything else fails. This enables URLs like
// /foo/bar/?wicket:bookmarkablePage=my.Page to be resolved, where
// is either a valid mount or a non-valid mount. I (Eelco) am not
// absolutely sure this is a great way to go, but it seems to have been
// established as the default way of doing things. If we ever want to
// tighten the algorithm up, it should be combined by going back to
// unmounted paths so that requests with Wicket parameters like
// 'bookmarkablePage' are always created and resolved in the same
// fashion. There is a test for this in UrlMountingTest.
if (target == null)
{
  // still null? check for a mount
  target = requestCodingStrategy.targetForRequest(requestParameters);

  if (target == null && requestParameters.getComponentPath() != null)
  {
    // If the target is still null and there was a component path
    // then the Page could not be located in the session
    throw new PageExpiredException(
      "Cannot find the rendered page in session [pagemap=" +
        requestParameters.getPageMapName() + ",componentPath=" +
        requestParameters.getComponentPath() + ",versionNumber=" +
        requestParameters.getVersionNumber() + "]");
  }
}

> > -----Original Message-----
> > From: Dale Ogilvie [mailto:Dale_Ogilvie@trimble.com]
> > Sent: Wednesday, 30 May 2012 9:52 a.m.
> > To: users@wicket.apache.org
> > Subject: Specified expiration page not being shown
> >
> > Hi,
> >
> > This is for wicket 1.4.20.
> >
> > In our WebApplication subclass we have used:
> >
> >
getApplicationSettings().setPageExpiredErrorPage(MyExpiredPage.class);
> >
> > However after session has expired on one of our pages, if I submit
the
> (fairly
> > complex) form, the form error message is shown. By this I mean that
> page
> > component validation fires and validation of an object from session
> (now
> > defunct) fails and the page is redrawn with an error message in the
> feedback
> > panel. The expired page IS displayed if an ajax backed combo is used
> on the
> > same form, only form submission avoids the expiry page.
> >
> > Why might it be that our MyExpiredPage is not being shown in the
form
> > submission case? We want our expired page to be displayed
> consistently.
> >
> > Thanks for any suggestions as to where to look for the issue.
> >
> > Dale
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org


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


RE: Specified expiration page not being shown

Posted by Dale Ogilvie <Da...@trimble.com>.
I have narrowed the behaviour that prevents our MyExpiredPage appearing
to this code below, specifically the StringEqualsValidator.

	        captchaToken = new
RequiredTextField<String>("captchaToken", 
	                new PropertyModel<String>(this,
"captchaEntered"))
	                {
	                    @Override
	                    protected final void onComponentTag(final
ComponentTag tag)
	                    {
	                        
	                        super.onComponentTag(tag);
	                        // clear the field after each render
	                        if ( captchaToken.hasErrorMessage() ) {
	                            tag.put("value", "");
	                        }
	                    }
	                };
	         captchaToken.add(new StringEqualsValidator(
captcha.getAnswer() ));


public class StringEqualsValidator implements IValidator<String> {
 
	private final String toCompare;
	
	public StringEqualsValidator(String str) {
		toCompare = str;
	}
 
	@Override
	public void validate(IValidatable<String> validatable) {
		final String input = validatable.getValue();
		
		if (StringUtils.equals(input, toCompare) == false) {
			error(validatable, "notequal");
		}
	}
 
	private void error(IValidatable<String> validatable, String
errorKey) {
		ValidationError error = new ValidationError();
		error.addMessageKey(getClass().getSimpleName() + "." +
errorKey);
		validatable.error(error);
	}
 
}

> -----Original Message-----
> From: Dale Ogilvie [mailto:Dale_Ogilvie@trimble.com]
> Sent: Wednesday, 30 May 2012 9:52 a.m.
> To: users@wicket.apache.org
> Subject: Specified expiration page not being shown
> 
> Hi,
> 
> This is for wicket 1.4.20.
> 
> In our WebApplication subclass we have used:
> 
> getApplicationSettings().setPageExpiredErrorPage(MyExpiredPage.class);
> 
> However after session has expired on one of our pages, if I submit the
(fairly
> complex) form, the form error message is shown. By this I mean that
page
> component validation fires and validation of an object from session
(now
> defunct) fails and the page is redrawn with an error message in the
feedback
> panel. The expired page IS displayed if an ajax backed combo is used
on the
> same form, only form submission avoids the expiry page.
> 
> Why might it be that our MyExpiredPage is not being shown in the form
> submission case? We want our expired page to be displayed
consistently.
> 
> Thanks for any suggestions as to where to look for the issue.
> 
> Dale
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org


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