Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
6.16.0
-
None
-
None
Description
I'd like to throw e.g. NotLoggedInException which will be handled by onException which then does a RestartResponseAtInterceptPage:
private final class NotLoggedInRequestCycleListener extends AbstractRequestCycleListener { @Override public IRequestHandler onException(RequestCycle cycle, Exception ex) { // Since our actual exception is wrapped, we need to find based on the chain final List<Throwable> chain = Throwables.getCausalChain(ex); final NotLoggedInException notLoggedInException = Iterables.getFirst( Iterables.filter(chain, NotLoggedInException.class), null); if (notLoggedInException != null) { final Url url = cycle.getRequest().getClientUrl(); log.debug("Got exception " + notLoggedInException.getClass().getName() + " on " + url, ex); final SoluvasWebSession session = (SoluvasWebSession) Session.get(); session.setOriginalUrl(url); session.info("Please log in"); session.dirty(); throw new RestartResponseAtInterceptPageException(DedicatedLoginPage.class); } else { return super.onException(cycle, ex); } } }
which doesn't work:
Caused by: javax.servlet.ServletException: Cannot process filter: org.apache.wicket.RestartResponseAtInterceptPageException at org.soluvas.web.site.SecuredWicketAtmosphereHandler$CustomFilterChain.doFilter(SecuredWicketAtmosphereHandler.java:201) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) at org.soluvas.web.site.SecuredWicketAtmosphereHandler$CustomFilterChain.doFilter(SecuredWicketAtmosphereHandler.java:199) ... 25 more Caused by: org.apache.wicket.RestartResponseAtInterceptPageException
because Wicket requires an IRequestHandler instead in this phase.