/** * Load a class using the current {link Thread#getContextClassLoader} * @param clazzName The name of the class you want to load. * @return an instance of clazzname */ public static Object load(String clazzName) { return load(clazzName,Thread.currentThread().getContextClassLoader()); }
/** * Load a class using the current {link Thread#getContextClassLoader} * @param clazzName The name of the class you want to load. * @return an instance of clazzname */ public static Object load(String clazzName) { return load(clazzName,Thread.currentThread().getContextClassLoader()); }
/** * Load the list of <code>AsynchFilter</code>. */ protected static ArrayList<AsyncFilter> loadFilters(){ ArrayList<AsyncFilter> al = new ArrayList<AsyncFilter>(); if ( System.getProperty(ASYNC_FILTER) != null){ StringTokenizer st = new StringTokenizer( System.getProperty(ASYNC_FILTER),","); while (st.hasMoreTokens()){ AsyncFilter filter = (AsyncFilter)ClassLoaderUtil.load(st.nextToken()); if (filter != null) { al.add(filter); } } } return al; }
String servletClassName = System.getProperty("com.sun.grizzly.servletClass"); if (servletClassName != null) { servletInstance = (Servlet)ClassLoaderUtil.load(servletClassName);
@Override public Adapter configureAdapter(SelectorThread st) { String adapterClass = System.getProperty(ADAPTER); Adapter adapter; if (adapterClass == null){ adapter = new StaticResourcesAdapter(folder); } else { adapter = (Adapter)ClassLoaderUtil.load(adapterClass); } if (adapter instanceof StaticResourcesAdapter){ ((StaticResourcesAdapter)adapter).setRootFolder(folder); } if (adapter instanceof DynamicContentAdapter){ ((DynamicContentAdapter)adapter).setContextRoot("/"); } return adapter; }
/** * Enable support for protocol like HTTP or AJP (Apache Java Protocol like mod_jk) * @param p the {@link PROTOCOL} */ public void enableProtocol(PROTOCOL p){ isStarted = false; if (p == PROTOCOL.AJP){ grizzlyListener = (GrizzlyListener) ClassLoaderUtil.load("com.sun.grizzly.http.jk.server.JkCoyoteHandler"); grizzlyListener.setAdapter(adapter()); } else { createSelectorThread(port, isStarted); } }
@Override public Adapter configureAdapter(SelectorThread st) { ServletAdapter adapter = new ServletAdapter(); adapter.setRootFolder(st.getWebAppRootPath()); adapter.setHandleStaticResources(true); Servlet servlet = (Servlet) ClassLoaderUtil.load(servletClassName); if (servlet != null) { System.out.println("Launching Servlet: " + servlet.getClass().getName()); adapter.setServletInstance(servlet); } else { SelectorThread.logger().log(Level.WARNING, "Unable to load Servlet, " + "Will serve only static resources"); return new StaticResourcesAdapter(st.getWebAppRootPath()); } return adapter; }
String selectorThreadClassname = System.getProperty(SELECTOR_THREAD); if (selectorThreadClassname != null) { st = (SelectorThread) ClassLoaderUtil.load(selectorThreadClassname); } else { st = new SelectorThread() {