@Override protected boolean accepts(ProcessingContext context, PathElementsProvider provider) { String current = provider.current(); SemesterContext ownContext = (SemesterContext) context; ownContext.setSemester(current); return ownContext.getSemesterNumber() != null; }
@Override protected boolean forward(ProcessingContext context, PathElementsProvider provider) throws IOException, ServletException { if (provider.hasNext()) { return false; } else { SemesterContext ownContext = (SemesterContext) context; ExecutionCourse executionCourse = ownContext.getExecutionCourse(); if (executionCourse == null) { return false; } else { /* * This is an ugly hack so this process still works until the * semester ends where we can easily notify everyone that the * link format has changed. * * 04-02-2007 pcma */ HttpServletRequest request = context.getRequest(); ExecutionCourseSite portalInstance = executionCourse.getSite(); MetaDomainObjectPortal portal = MetaDomainObjectPortal.getPortal(portalInstance.getClass()); List<Content> contents = new ArrayList<Content>(); contents.add(portal); contents.add(portalInstance); FilterFunctionalityContext filterContext = (FilterFunctionalityContext) request.getAttribute(FunctionalityContext.CONTEXT_KEY); if (filterContext != null) { request.removeAttribute(FunctionalityContext.CONTEXT_KEY); } filterContext = new FilterFunctionalityContext(request, contents); filterContext.setHasBeenForwarded(); request.setAttribute(FunctionalityContext.CONTEXT_KEY, filterContext); String url = portalInstance.getReversePath(); context.getResponse().sendRedirect(context.getRequest().getContextPath() + url); return true; } } }