@Test @Issue("#109") public void ignoreInterfaces() throws MalformedURLException { ServletContext context = mock(ServletContext.class); when(context.getResource(any(String.class))).thenReturn(null); assertNull(IndexHtmlDispatcher.make(context, TestInterface.class)); }
static Dispatcher make(ServletContext context, Class c) { for (; c != null && c != Object.class; c = c.getSuperclass()) { String name = "/WEB-INF/side-files/" + c.getName().replace('.', '/') + "/index.html"; try { URL url = context.getResource(name); if (url != null) return new IndexHtmlDispatcher(url); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } return null; }
IndexHtmlDispatcher extends Dispatcher { static Dispatcher make(ServletContext context, Class c) { for (; c != null && c != Object.class; c = c.getSuperclass()) { String name = "/WEB-INF/side-files/" + c.getName().replace('.', '/') + "/index.html"; try { URL url = context.getResource(name); if (url != null) return new IndexHtmlDispatcher(url); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } return null; } }
IndexHtmlDispatcher extends Dispatcher { static Dispatcher make(ServletContext context, Class c) { for (; c != null && c != Object.class; c = c.getSuperclass()) { String name = "/WEB-INF/side-files/" + c.getName().replace('.', '/') + "/index.html"; try { URL url = context.getResource(name); if (url != null) return new IndexHtmlDispatcher(url); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } return null; } IndexHtmlDispatcher(URL html); }
IndexHtmlDispatcher extends Dispatcher { static Dispatcher make(ServletContext context, Class c) { for (; c != null && c != Object.class; c = c.getSuperclass()) { String name = "/WEB-INF/side-files/" + c.getName().replace('.', '/') + "/index.html"; try { URL url = context.getResource(name); if (url != null) return new IndexHtmlDispatcher(url); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } return null; } IndexHtmlDispatcher(URL html); @Override boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node); @Override String toString(); }
IndexHtmlDispatcher extends Dispatcher { static Dispatcher make(ServletContext context, Class c) { for (; c != null && c != Object.class; c = c.getSuperclass()) { String name = "/WEB-INF/side-files/" + c.getName().replace('.', '/') + "/index.html"; try { URL url = context.getResource(name); if (url != null) return new IndexHtmlDispatcher(url); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } return null; } IndexHtmlDispatcher(URL html); @Override boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node); @Override String toString();  }