List of usage examples for org.apache.wicket.request Url removeQueryParameters
public void removeQueryParameters(final String name)
From source file:org.jabylon.rest.ui.wicket.CustomExceptionMapper.java
License:Open Source License
@Override public IRequestHandler map(Exception e) { if (e instanceof ObjectNotFoundException) { //see https://github.com/jutzig/jabylon/issues/175 Request request = RequestCycle.get().getRequest(); Url url = request.getUrl(); List<QueryParameter> parameters = url.getQueryParameters(); boolean redirected = false; for (QueryParameter queryParameter : parameters) { if (queryParameter.getValue().isEmpty() && queryParameter.getName().matches("\\d+")) { url.removeQueryParameters(queryParameter.getName()); LOG.error("Detected request to expired CDO ID. Attempting redirect to " + url.toString(), e); Session.get().error("Sorry, this page content has expired. Please try again"); redirected = true;/*from w w w . ja v a 2s . c om*/ break; } } if (redirected) return new RedirectRequestHandler("/" + url.toString()); } return super.map(e); }