@Override public Set<String> addMapping(String... urlPatterns) { if (urlPatterns == null) { return Collections.emptySet(); } Set<String> conflicts = new HashSet<>(); for (String urlPattern : urlPatterns) { String wrapperName = context.findServletMapping(urlPattern); if (wrapperName != null) { Wrapper wrapper = (Wrapper) context.findChild(wrapperName); if (wrapper.isOverridable()) { // Some Wrappers (from global and host web.xml) may be // overridden rather than generating a conflict context.removeServletMapping(urlPattern); } else { conflicts.add(urlPattern); } } } if (!conflicts.isEmpty()) { return conflicts; } for (String urlPattern : urlPatterns) { context.addServletMapping(urlPattern, wrapper.getName()); } return Collections.emptySet(); }
@Override public Set<String> addMapping(String... urlPatterns) { if (urlPatterns == null) { return Collections.emptySet(); } Set<String> conflicts = new HashSet<String>(); for (String urlPattern : urlPatterns) { String wrapperName = context.findServletMapping(urlPattern); if (wrapperName != null) { Wrapper wrapper = (Wrapper) context.findChild(wrapperName); if (wrapper.isOverridable()) { // Some Wrappers (from global and host web.xml) may be // overridden rather than generating a conflict context.removeServletMapping(urlPattern); } else { conflicts.add(urlPattern); } } } if (!conflicts.isEmpty()) { return conflicts; } for (String urlPattern : urlPatterns) { context.addServletMapping(urlPattern, wrapper.getName()); } return Collections.emptySet(); }
@Override public Set<String> addMapping(String... urlPatterns) { if (urlPatterns == null) { return Collections.emptySet(); } Set<String> conflicts = new HashSet<String>(); for (String urlPattern : urlPatterns) { String wrapperName = context.findServletMapping(urlPattern); if (wrapperName != null) { Wrapper wrapper = (Wrapper) context.findChild(wrapperName); if (wrapper.isOverridable()) { // Some Wrappers (from global and host web.xml) may be // overridden rather than generating a conflict context.removeServletMapping(urlPattern); } else { conflicts.add(urlPattern); } } } if (!conflicts.isEmpty()) { return conflicts; } for (String urlPattern : urlPatterns) { context.addServletMapping(urlPattern, wrapper.getName()); } return Collections.emptySet(); }
if (wrapperName != null) { Wrapper wrapper = (Wrapper) context.findChild(wrapperName); if (wrapper.isOverridable()) {
if (wrapperName != null) { Wrapper wrapper = (Wrapper) context.findChild(wrapperName); if (wrapper.isOverridable()) {
if (wrapper.getName() != null && wrapper.getServletClass() != null) { if (wrapper.isOverridable()) { wrapper.setOverridable(false); } else {
if (wrapper.getName() != null && wrapper.getServletClass() != null) { if (wrapper.isOverridable()) { wrapper.setOverridable(false); } else {
if (wrapper.getName() != null && wrapper.getServletClass() != null) { if (wrapper.isOverridable()) { wrapper.setOverridable(false); } else {
if (wrapper.getName() != null && wrapper.getServletClass() != null) { if (wrapper.isOverridable()) { wrapper.setOverridable(false); } else {
public Set<String> addMapping(String... urlPatterns) { Set<String> conflicts = new HashSet<String>(); if (!((Context) wrapper.getParent()).isStarting()) { throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath()); } if (urlPatterns == null || urlPatterns.length == 0) { throw MESSAGES.invalidServletRegistrationArguments(); } for (String urlPattern : urlPatterns) { Context context = ((Context) wrapper.getParent()); String wrapperName = context.findServletMapping(urlPattern); if (wrapperName != null) { Wrapper servletWrapper = (Wrapper) context.findChild(wrapperName); if (servletWrapper.isOverridable()) { // Some Wrappers (from global and host web.xml) may be // overridden rather than generating a conflict context.removeServletMapping(urlPattern); } else { conflicts.add(urlPattern); } } } if (conflicts.isEmpty()) { for (String urlPattern : urlPatterns) { ((Context) wrapper.getParent()).addServletMapping(urlPattern, wrapper.getName()); } } return conflicts; }
if (wrapper.getName() != null && wrapper.getServletClass() != null) { if (wrapper.isOverridable()) { wrapper.setOverridable(false); } else {
if (existingWrapper.isOverridable()) { existingWrapper.setOverridable(false); } else {
public ServletRegistration.Dynamic addServlet(String servletName, String className) throws IllegalArgumentException, IllegalStateException { if (restricted) { throw MESSAGES.restrictedListenerCannotCallMethod(); } if (!context.isStarting()) { throw MESSAGES.contextAlreadyInitialized(getContextPath()); } Wrapper existingWrapper = (Wrapper)context.findChild(servletName); if (existingWrapper != null) { if (existingWrapper.isOverridable()) { existingWrapper.setOverridable(false); } else { return null; } } Wrapper wrapper = context.createWrapper(); wrapper.setDynamic(true); wrapper.setName(servletName); wrapper.setServletClass(className); context.addChild(wrapper); return (ServletRegistration.Dynamic) wrapper.getFacade(); }