private void cleanUpRestServlets() { final WebAppInfo webAppInfo = info.get(); final AppInfo appInfo = info.app(); if (webAppInfo == null || appInfo == null || "false".equalsIgnoreCase(appInfo.properties.getProperty("openejb.jaxrs.on", "true"))) { return; if (servletClass == null || "org.apache.openejb.server.rest.OpenEJBRestServlet".equals(servletClass) || !HttpServlet.class.isAssignableFrom(info.loader().loadClass(servletClass))) { context.removeChild(child);
standardContext.addLifecycleListener(new OpenEJBContextConfig(new StandardContextInfo(standardContext)));
standardContext.addLifecycleListener(new OpenEJBContextConfig(new StandardContextInfo(standardContext)));
final WebAppInfo webAppInfo = info.get();
final boolean handlesTypesOnly, final Map<String,JavaClassCacheEntry> javaClassCache) { final WebAppInfo webAppInfo = info.get(); if (webAppInfo != null && FileResource.class.isInstance(webResource)) { final File file = new File(FileResource.class.cast(webResource).getCanonicalPath());
private void addAddedJAXWsServices() { final WebAppInfo webAppInfo = info.get(); final AppInfo appInfo = info.app(); if (webAppInfo == null || appInfo == null || "false".equalsIgnoreCase(appInfo.properties.getProperty("openejb.jaxws.add-missing-servlets", "true"))) { return; } try { // if no jaxws classes are here don't try anything OpenEJBContextConfig.class.getClassLoader().loadClass("org.apache.openejb.server.webservices.WsServlet"); } catch (final ClassNotFoundException | NoClassDefFoundError e) { return; } for (final ServletInfo servlet : webAppInfo.servlets) { if (!servlet.mappings.iterator().hasNext()) { // no need to do anything continue; } for (final ParamValueInfo pv : servlet.initParams) { if ("openejb-internal".equals(pv.name) && "true".equals(pv.value)) { if (context.findChild(servlet.servletName) == null) { final Wrapper wrapper = context.createWrapper(); wrapper.setName(servlet.servletName); wrapper.setServletClass("org.apache.openejb.server.webservices.WsServlet"); // add servlet to context context.addChild(wrapper); context.addServletMappingDecoded(servlet.mappings.iterator().next(), wrapper.getName()); } break; } } } }
@Override protected void processAnnotationsUrl(final URL currentUrl, final WebXml fragment, final boolean handlesTypeOnly, final Map<String,JavaClassCacheEntry> javaClassCache) { if (NewLoaderLogic.skip(currentUrl)) { // we potentially see all common loader urls return; } final WebAppInfo webAppInfo = info.get(); if (webAppInfo == null) { super.processAnnotationsUrl(currentUrl, fragment, handlesTypeOnly, javaClassCache); return; } File currentUrlAsFile; try { currentUrlAsFile = URLs.toFile(currentUrl); } catch (final IllegalArgumentException iae) { logger.error("Don't know this url: " + currentUrl); return; } internalProcessAnnotations(currentUrlAsFile, webAppInfo, fragment); }
@Override protected void processAnnotationsFile(final File file, final WebXml fragment, final boolean handlesTypesOnly, final Map<String,JavaClassCacheEntry> javaClassCache) { try { if (NewLoaderLogic.skip(file.toURI().toURL())) { return; } } catch (final MalformedURLException e) { // no-op: let it be } final WebAppInfo webAppInfo = info.get(); if (webAppInfo == null) { super.processAnnotationsFile(file, fragment, handlesTypesOnly, javaClassCache); return; } internalProcessAnnotations(file, webAppInfo, fragment); }
public OpenEJBContextConfig(final TomcatWebAppBuilder.StandardContextInfo standardContextInfo) { logger.debug("OpenEJBContextConfig({0})", standardContextInfo.toString()); info = standardContextInfo; }