@Override public void tearDown() throws Exception { filterConfig = null; frontController.destroy(); frontController = null; filterChain = null; super.tearDown(); }
/** * Starts the request process. * * @param path the request path * @throws NullPointerException if the path parameter is null * @throws IllegalArgumentException if the path does not start with "/" * @throws IOException if {@link IOException} occurred * @throws ServletException if {@link ServletException} occurred */ public void start(String path) throws NullPointerException, IllegalArgumentException, IOException, ServletException { if (path == null) { throw new NullPointerException("The path parameter is null."); } if (!path.startsWith("/")) { throw new IllegalArgumentException("The path(" + path + ") must start with \"/\"."); } request.setAttribute(ControllerConstants.FORWARD_SERVLET_PATH_KEY, path); Router router = RouterFactory.getRouter(); String routingPath = router.route(request, path); if (routingPath != null) { int index = routingPath.lastIndexOf('?'); if (index < 0) { path = routingPath; } else { path = routingPath.substring(0, index); request.setQueryString(routingPath.substring(index + 1)); } request.setAttribute(ControllerConstants.ROUTED_KEY, true); } request.setServletPath(path); frontController.doFilter(request, response, filterChain); }
@Override public void setUp() throws Exception { super.setUp(); setUpServletContext(); frontController.init(filterConfig); }
/** Initializes the default bundle and CN message bundle. */ protected void initBundleName() { super.initBundleName(); ApplicationMessage.setDelegateClass(CNResourceBundleApplicationMessageDelegate.class); }