public void init(WebAppContext webAppContext) throws IOException { String railsRootDirName = webAppContext.getInitParameter("rails.root").replaceAll("/WEB-INF/", ""); String assetsDir = webAppContext.getWebInf().addPath(String.format("%s/public/assets/", railsRootDirName)).getName(); handler.setAssetsDir(assetsDir); }
@Before public void setUp() throws Exception { initMocks(this); when(systemEnvironment.getWebappContextPath()).thenReturn("/go"); when(webAppContext.getInitParameter("rails.root")).thenReturn("/rails.root"); when(webAppContext.getWebInf()).thenReturn(Resource.newResource("WEB-INF")); handler = new AssetsContextHandler(systemEnvironment); handler.init(webAppContext); }
/** * Get <code>WEB-INF/classes</code> dir * * @param context the context to look for the <code>WEB-INF/classes</code> directory * @return the Resource for the <code>WEB-INF/classes</code> directory * @throws Exception if unable to find the <code>WEB-INF/classes</code> directory */ protected Resource findWebInfClassesDir (WebAppContext context) throws Exception { if (context == null) return null; Resource web_inf = context.getWebInf(); // Find WEB-INF/classes if (web_inf != null && web_inf.isDirectory()) { // Look for classes directory Resource classes= web_inf.addPath("classes/"); if (classes.exists()) return classes; } return null; }
throws Exception Resource web_inf = context.getWebInf(); if (web_inf==null || !web_inf.exists()) return null;
protected Resource findWebXml(WebAppContext context) throws IOException, MalformedURLException { String descriptor = context.getDescriptor(); if (descriptor != null) { Resource web = context.newResource(descriptor); if (web.exists() && !web.isDirectory()) return web; } Resource web_inf = context.getWebInf(); if (web_inf != null && web_inf.isDirectory()) { // do web.xml file Resource web = web_inf.addPath("web.xml"); if (web.exists()) return web; if (LOG.isDebugEnabled()) LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only"); } return null; }
Resource web_inf = context.getWebInf();
Resource web_inf = context.getWebInf();
public File findWorkDirectory (WebAppContext context) throws IOException { if (context.getBaseResource() != null) { Resource web_inf = context.getWebInf(); if (web_inf !=null && web_inf.exists()) { return new File(web_inf.getFile(),"work"); } } return null; }
public File findWorkDirectory (WebAppContext context) throws IOException { if (context.getBaseResource() != null) { Resource web_inf = context.getWebInf(); if (web_inf !=null && web_inf.exists()) { return new File(web_inf.getFile(),"work"); } } return null; }
public File findWorkDirectory (WebAppContext context) throws IOException { if (context.getBaseResource() != null) { Resource web_inf = context.getWebInf(); if (web_inf !=null && web_inf.exists()) { return new File(web_inf.getFile(),"work"); } } return null; }
public File findWorkDirectory (WebAppContext context) throws IOException { if (context.getBaseResource() != null) { Resource web_inf = context.getWebInf(); if (web_inf !=null && web_inf.exists()) { return new File(web_inf.getFile(),"work"); } } return null; }
public File findWorkDirectory (WebAppContext context) throws IOException { if (context.getBaseResource() != null) { Resource web_inf = context.getWebInf(); if (web_inf !=null && web_inf.exists()) { return new File(web_inf.getFile(),"work"); } } return null; }
/** * Get the quickstart-web.xml file as a Resource. * * @param context the web app context * @return the Resource for the quickstart-web.xml * @throws Exception if unable to find the quickstart xml */ public Resource getQuickStartWebXml (WebAppContext context) throws Exception { Resource webInf = context.getWebInf(); if (webInf == null || !webInf.exists()) throw new IllegalStateException("No WEB-INF"); LOG.debug("webinf={}",webInf); Resource quickStartWebXml = webInf.addPath("quickstart-web.xml"); if (!quickStartWebXml.exists()) throw new IllegalStateException ("No WEB-INF/quickstart-web.xml"); return quickStartWebXml; }
protected Resource findWebXml(WebAppContext context) throws IOException, MalformedURLException { String descriptor = context.getDescriptor(); if (descriptor != null) { Resource web = context.newResource(descriptor); if (web.exists() && !web.isDirectory()) return web; } Resource web_inf = context.getWebInf(); if (web_inf != null && web_inf.isDirectory()) { // do web.xml file Resource web = web_inf.addPath("web.xml"); if (web.exists()) return web; if (LOG.isDebugEnabled()) LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only"); } return null; }
protected Resource findWebXml(WebAppContext context) throws IOException, MalformedURLException { String descriptor = context.getDescriptor(); if (descriptor != null) { Resource web = context.newResource(descriptor); if (web.exists() && !web.isDirectory()) return web; } Resource web_inf = context.getWebInf(); if (web_inf != null && web_inf.isDirectory()) { // do web.xml file Resource web = web_inf.addPath("web.xml"); if (web.exists()) return web; if (LOG.isDebugEnabled()) LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only"); } return null; }
protected Resource findWebXml(WebAppContext context) throws IOException, MalformedURLException { String descriptor = context.getDescriptor(); if (descriptor != null) { Resource web = context.newResource(descriptor); if (web.exists() && !web.isDirectory()) return web; } Resource web_inf = context.getWebInf(); if (web_inf != null && web_inf.isDirectory()) { // do web.xml file Resource web = web_inf.addPath("web.xml"); if (web.exists()) return web; if (LOG.isDebugEnabled()) LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only"); } return null; }
protected Resource findWebXml(WebAppContext context) throws IOException, MalformedURLException { String descriptor = context.getDescriptor(); if (descriptor != null) { Resource web = context.newResource(descriptor); if (web.exists() && !web.isDirectory()) return web; } Resource web_inf = context.getWebInf(); if (web_inf != null && web_inf.isDirectory()) { // do web.xml file Resource web = web_inf.addPath("web.xml"); if (web.exists()) return web; if (LOG.isDebugEnabled()) LOG.debug("No WEB-INF/web.xml in " + context.getWar() + ". Serving files and default/dynamic servlets only"); } return null; }
protected static void process(WebAppContext wac, boolean startNewHandler) throws Exception { EclipseWeldServletHandler wHandler = new EclipseWeldServletHandler(wac.getServletHandler(), wac.getServletContext()); wac.setServletHandler(wHandler); wac.getSecurityHandler().setHandler(wHandler); if (startNewHandler) { wHandler.start(); } Resource jettyEnv = null; Resource webInf = wac.getWebInf(); if (webInf != null && webInf.exists()) { jettyEnv = webInf.addPath("jetty-env.xml"); } if (jettyEnv == null || !(jettyEnv.exists())) { JettyLogger.LOG.missingJettyEnvXml(); } }
protected static void process(WebAppContext wac, boolean startNewHandler) throws Exception { EclipseWeldServletHandler wHandler = new EclipseWeldServletHandler(wac.getServletHandler(), wac.getServletContext()); wac.setServletHandler(wHandler); wac.getSecurityHandler().setHandler(wHandler); if (startNewHandler) { wHandler.start(); } Resource jettyEnv = null; Resource webInf = wac.getWebInf(); if (webInf != null && webInf.exists()) { jettyEnv = webInf.addPath("jetty-env.xml"); } if (jettyEnv == null || !(jettyEnv.exists())) { JettyLogger.LOG.missingJettyEnvXml(); } }
protected static void process(WebAppContext wac, boolean startNewHandler) throws Exception { EclipseWeldServletHandler wHandler = new EclipseWeldServletHandler(wac.getServletHandler(), wac.getServletContext()); wac.setServletHandler(wHandler); wac.getSecurityHandler().setHandler(wHandler); if (startNewHandler) { wHandler.start(); } Resource jettyEnv = null; Resource webInf = wac.getWebInf(); if (webInf != null && webInf.exists()) { jettyEnv = webInf.addPath("jetty-env.xml"); } if (jettyEnv == null || !(jettyEnv.exists())) { JettyLogger.LOG.missingJettyEnvXml(); } }