public void setDefaultMapping(@Observes final BeforeAppInfoBuilderEvent event) { final AppModule module = event.getAppModule(); if (module == null) { return; } final List<WebModule> webModules = module.getWebModules(); final String ignore = SystemInstance.get().getProperty(DEFAULT_RS_APPLICATION_IGNORE.replace("com.tomi", ""), System.getProperty(DEFAULT_RS_APPLICATION_IGNORE, module.getProperties().getProperty(DEFAULT_RS_APPLICATION_IGNORE))); final String mapping = System.getProperty(DEFAULT_RS_APPLICATION_MAPPING, "/api/*"); if (!Boolean.parseBoolean(ignore) && !webModules.isEmpty() /*for tests mainly*/ && !isOAuth2(module)) { for (final WebModule webModule : webModules) { final WebApp webApp = webModule.getWebApp(); if (webApp == null) continue; // can't happen if (!webModule.getRestApplications().isEmpty()) continue; // already a REST application if ("tomitribe-monitor-internal".equals(webModule.getModuleId())) continue; // monitoring internal webapp if ("tomitribe-monitor-internal".equals(webApp.getId())) continue; // monitor process LOGGER.info(WadlxCodes.APPLICATION_CONFIGURER, "No REST application defined for application: {0}. Automatically adding a default JAX RS mapping for it on {1}/{2}. " + "Add a class annotated with @javax.ws.rs.ApplicationPath to the application to specify this mapping manually.", webModule.getModuleId(), webModule.getContextRoot(), mapping.replaceAll("^/+", "")); // strip off leading / characters webApp .addServlet(InternalApplication.class.getName(), null, SystemInstance.get().getProperty( DEFAULT_RS_APPLICATION_IGNORE.replace("com.tomi", ""), mapping)); } } }
webAppInfo.contextRoot = appModule.getModuleId() + "/" + webModule.getContextRoot(); } else { webAppInfo.contextRoot = webModule.getContextRoot();
private void buildWebModules(AppModule appModule, JndiEncInfoBuilder jndiEncInfoBuilder, AppInfo appInfo) throws OpenEJBException { for (WebModule webModule : appModule.getWebModules()) { WebApp webApp = webModule.getWebApp(); WebAppInfo webAppInfo = new WebAppInfo(); webAppInfo.description = webApp.getDescription(); webAppInfo.displayName = webApp.getDisplayName(); webAppInfo.codebase = webModule.getJarLocation(); webAppInfo.moduleId = webModule.getModuleId(); webAppInfo.watchedResources.addAll(webModule.getWatchedResources()); webAppInfo.host = webModule.getHost(); webAppInfo.contextRoot = webModule.getContextRoot(); webAppInfo.jndiEnc = jndiEncInfoBuilder.build(webApp, webModule.getJarLocation(), webAppInfo.moduleId); webAppInfo.portInfos.addAll(configureWebservices(webModule.getWebservices())); configureWebserviceSecurity(webAppInfo, webModule); for (Servlet servlet : webModule.getWebApp().getServlet()) { ServletInfo servletInfo = new ServletInfo(); servletInfo.servletName = servlet.getServletName(); servletInfo.servletClass = servlet.getServletClass(); webAppInfo.servlets.add(servletInfo); } appInfo.webApps.add(webAppInfo); } }
webAppInfo.contextRoot = appModule.getModuleId() + "/" + webModule.getContextRoot(); } else { webAppInfo.contextRoot = webModule.getContextRoot();
for (WebModule webModule : app.getWebModules()) { ids.add(webModule.getModuleId()); ids.add(webModule.getContextRoot());
for (final WebModule webModule : app.getWebModules()) { ids.add(webModule.getModuleId()); ids.add(webModule.getContextRoot());
for (final WebModule webModule : app.getWebModules()) { ids.add(webModule.getModuleId()); ids.add(webModule.getContextRoot());