@Nullable private String getBeanNameByType(WebApplicationContext wac, Class<?> endpointClass) { String wacId = wac.getId(); Map<Class<?>, String> beanNamesByType = cache.get(wacId); if (beanNamesByType == null) { beanNamesByType = new ConcurrentHashMap<>(); cache.put(wacId, beanNamesByType); } if (!beanNamesByType.containsKey(endpointClass)) { String[] names = wac.getBeanNamesForType(endpointClass); if (names.length == 1) { beanNamesByType.put(endpointClass, names[0]); } else { beanNamesByType.put(endpointClass, NO_VALUE); if (names.length > 1) { throw new IllegalStateException("Found multiple @ServerEndpoint's of type [" + endpointClass.getName() + "]: bean names " + Arrays.asList(names)); } } } String beanName = beanNamesByType.get(endpointClass); return (NO_VALUE.equals(beanName) ? null : beanName); }
@Nullable private String getBeanNameByType(WebApplicationContext wac, Class<?> endpointClass) { String wacId = wac.getId(); Map<Class<?>, String> beanNamesByType = cache.get(wacId); if (beanNamesByType == null) { beanNamesByType = new ConcurrentHashMap<>(); cache.put(wacId, beanNamesByType); } if (!beanNamesByType.containsKey(endpointClass)) { String[] names = wac.getBeanNamesForType(endpointClass); if (names.length == 1) { beanNamesByType.put(endpointClass, names[0]); } else { beanNamesByType.put(endpointClass, NO_VALUE); if (names.length > 1) { throw new IllegalStateException("Found multiple @ServerEndpoint's of type [" + endpointClass.getName() + "]: bean names " + Arrays.asList(names)); } } } String beanName = beanNamesByType.get(endpointClass); return (NO_VALUE.equals(beanName) ? null : beanName); }
@Nullable private String getBeanNameByType(WebApplicationContext wac, Class<?> endpointClass) { String wacId = wac.getId(); Map<Class<?>, String> beanNamesByType = cache.get(wacId); if (beanNamesByType == null) { beanNamesByType = new ConcurrentHashMap<>(); cache.put(wacId, beanNamesByType); } if (!beanNamesByType.containsKey(endpointClass)) { String[] names = wac.getBeanNamesForType(endpointClass); if (names.length == 1) { beanNamesByType.put(endpointClass, names[0]); } else { beanNamesByType.put(endpointClass, NO_VALUE); if (names.length > 1) { throw new IllegalStateException("Found multiple @ServerEndpoint's of type [" + endpointClass.getName() + "]: bean names " + Arrays.asList(names)); } } } String beanName = beanNamesByType.get(endpointClass); return (NO_VALUE.equals(beanName) ? null : beanName); }
private void debug(final WebApplicationContext ctx) { // DEBUG if ( DEBUG ) { logger.debug("SearchServlet: Context Display name = " + ctx.getDisplayName()); logger.debug("SearchServlet: Context ID = " + ctx.getId()); if (ctx.getParent() == null) { logger.debug("SearchServlet: Context Parent is null."); } else { logger.debug("SearchServlet: Context Parent Display name = " + ctx.getParent().getDisplayName()); } if (ctx.getServletContext() == null) { logger.debug("SearchServlet: ServletContext is null."); } else { logger.debug("SearchServlet: ServletContext path = " + ctx.getServletContext().getContextPath()); logger.debug("SearchServlet: ServletContext context name = " + ctx.getServletContext().getServletContextName()); } } // DEBUG }
@Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { final WebApplicationContext context = getWebApplicationContext(); if (context.getApplicationName() != null) { root.put(prefix + "applicationName", context.getApplicationName()); } if (context.getDisplayName() != null) { root.put(prefix + "displayName", context.getDisplayName()); } root.put(prefix + "startUp", DateFormat.getDateTimeInstance().format(new Date(context.getStartupDate()))); if (context.getId() != null) { root.put(prefix + "id", context.getId()); } }
logger.debug( "InstanceServlet: Context ID = " + ctx.getId() ); if ( ctx.getParent() == null ) { logger.debug( "InstanceServlet: Context Parent is null." );