@Override public Servlet getServlet(String path) { ServletInfo servletInfo = _servletInfos.get(path); if (servletInfo == null) { return null; } Servlet servlet = servletInfo.getServlet(); if (PropsValues.DIRECT_SERVLET_CONTEXT_RELOAD) { long lastModified = getFileLastModified(path, servlet); if ((lastModified == 0) || (lastModified != servletInfo.getLastModified())) { _servletInfos.remove(path); servlet = null; if (_log.isDebugEnabled()) { _log.debug("Reload " + path); } } else { servlet = reloadDependants(path, servlet, servletInfo); } } return servlet; }
@Override public void putServlet(String path, Servlet servlet) { if (_servletInfos.containsKey(path)) { return; } long lastModified = 1; if (PropsValues.DIRECT_SERVLET_CONTEXT_RELOAD) { lastModified = getFileLastModified(path, servlet); } if (lastModified > 0) { ServletInfo servletInfo = new ServletInfo(); servletInfo.setLastModified(lastModified); servletInfo.setServlet(servlet); _servletInfos.put(path, servletInfo); } }
public void validate() { if (deploymentName == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("deploymentName"); } if (contextPath == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("contextName"); } if (classLoader == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("classLoader"); } if (resourceManager == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("resourceManager"); } if (classIntrospecter == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("classIntrospecter"); } if (defaultEncoding == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("defaultEncoding"); } for (final ServletInfo servlet : this.servlets.values()) { servlet.validate(); } for (final FilterInfo filter : this.filters.values()) { filter.validate(); } for (FilterMappingInfo mapping : this.filterServletNameMappings) { if (!this.filters.containsKey(mapping.getFilterName())) { throw UndertowServletMessages.MESSAGES.filterNotFound( mapping.getFilterName(), mapping.getMappingType() + " - " + mapping.getMapping()); } } for (FilterMappingInfo mapping : this.filterUrlMappings) { if (!this.filters.containsKey(mapping.getFilterName())) { throw UndertowServletMessages.MESSAGES.filterNotFound( mapping.getFilterName(), mapping.getMappingType() + " - " + mapping.getMapping()); } } }
public void validate() { if (deploymentName == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("deploymentName"); } if (contextPath == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("contextName"); } if (classLoader == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("classLoader"); } if (resourceLoader == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("resourceLoader"); } if (classIntrospecter == null) { throw UndertowServletMessages.MESSAGES.paramCannotBeNull("classIntrospecter"); } for (final ServletInfo servlet : this.servlets.values()) { servlet.validate(); } for (final FilterInfo filter : this.filters.values()) { filter.validate(); } }
public DeploymentInfo addServlet(final ServletInfo servlet) { servlets.put(servlet.getName(), servlet); return this; }
public DeploymentInfo addServlets(final Collection<ServletInfo> servlets) { for (final ServletInfo servlet : servlets) { this.servlets.put(servlet.getName(), servlet); } return this; }