private void contentsForward( final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse, final FilterFunctionalityContext functionalityContext) throws ServletException, IOException { Content content = functionalityContext.getSelectedContent(); if (LogLevel.INFO) { if (content == null) { System.out.println(httpServletRequest.getRequestURI() + " ---> null"); } else { System.out.println( httpServletRequest.getRequestURI() + " ---> " + content.getClass().getName()); } } if (content instanceof Redirect) { final Redirect redirect = (Redirect) content; sendRedirect(httpServletResponse, redirect.getUrl()); } else if (content instanceof Section) { dispatchTo(httpServletRequest, httpServletResponse, functionalityContext, SECTION_PATH); } else if (content instanceof Item) { dispatchTo(httpServletRequest, httpServletResponse, functionalityContext, ITEM_PATH); } else if (content instanceof Attachment) { Attachment attachment = (Attachment) content; httpServletResponse.sendRedirect(attachment.getFile().getDownloadUrl()); } else if (content instanceof FunctionalityCall) { Functionality functionality = ((FunctionalityCall) content).getFunctionality(); dispatchTo( httpServletRequest, httpServletResponse, functionalityContext, functionality.getPath()); } else if (content instanceof Functionality) { Functionality functionality = ((Functionality) content); dispatchTo( httpServletRequest, httpServletResponse, functionalityContext, functionality.getPath()); } }
private VirtualPath getVirtualPath(Site site, Container container) { List<Content> contents = site.getPathTo(container); final VirtualPath filePath = new VirtualPath(); for (Content content : contents.subList(1, contents.size())) { filePath.addNode( 0, new VirtualPathNode( content.getClass().getSimpleName().substring(0, 1) + content.getExternalId(), content.getName().getContent())); } String authorName = site.getAuthorName(); filePath.addNode( 0, new VirtualPathNode( "Site" + site.getExternalId(), authorName == null ? "Site" + site.getExternalId() : authorName)); ExecutionSemester executionSemester = site.getExecutionPeriod(); if (executionSemester == null) { filePath.addNode(0, new VirtualPathNode("Intemporal", "Intemporal")); } else { filePath.addNode( 0, new VirtualPathNode( "EP" + executionSemester.getExternalId(), executionSemester.getName())); ExecutionYear executionYear = executionSemester.getExecutionYear(); filePath.addNode( 0, new VirtualPathNode("EY" + executionYear.getExternalId(), executionYear.getYear())); } filePath.addNode(0, new VirtualPathNode("Courses", "Courses")); return filePath; }