/** * Gets the application servlet maps. * * @param context the context * @return the application servlet maps */ public static List<ServletMapping> getApplicationServletMaps(Context context) { String[] sms = context.findServletMappings(); List<ServletMapping> servletMaps = new ArrayList<>(sms.length); for (String servletMapping : sms) { if (servletMapping != null) { String sn = context.findServletMapping(servletMapping); if (sn != null) { ServletMapping sm = new ServletMapping(); sm.setApplicationName(context.getName().length() > 0 ? context.getName() : "/"); sm.setUrl(servletMapping); sm.setServletName(sn); Container container = context.findChild(sn); if (container instanceof Wrapper) { Wrapper wrapper = (Wrapper) container; sm.setServletClass(wrapper.getServletClass()); sm.setAvailable(!wrapper.isUnavailable()); } servletMaps.add(sm); } } } return servletMaps; }
@Override public Set<String> addMapping(String... urlPatterns) { if (urlPatterns == null) { return Collections.emptySet(); } Set<String> conflicts = new HashSet<String>(); for (String urlPattern : urlPatterns) { if (context.findServletMapping(urlPattern) != null) { conflicts.add(urlPattern); } } if (!conflicts.isEmpty()) { return conflicts; } for (String urlPattern : urlPatterns) { context.addServletMapping(urlPattern, wrapper.getName()); } return Collections.emptySet(); }
@Override public Collection<String> getMappings() { Set<String> result = new HashSet<String>(); String servletName = wrapper.getName(); String[] urlPatterns = context.findServletMappings(); for (String urlPattern : urlPatterns) { String name = context.findServletMapping(urlPattern); if (name.equals(servletName)) { result.add(urlPattern); } } return result; }
@Override public Set<String> addMapping(String... urlPatterns) { if (urlPatterns == null) { return Collections.emptySet(); } Set<String> conflicts = new HashSet<String>(); for (String urlPattern : urlPatterns) { if (context.findServletMapping(urlPattern) != null) { conflicts.add(urlPattern); } } if (!conflicts.isEmpty()) { return conflicts; } for (String urlPattern : urlPatterns) { context.addServletMapping(urlPattern, wrapper.getName()); } return Collections.emptySet(); }
@Override public Collection<String> getMappings() { Set<String> result = new HashSet<>(); String servletName = wrapper.getName(); String[] urlPatterns = context.findServletMappings(); for (String urlPattern : urlPatterns) { String name = context.findServletMapping(urlPattern); if (name.equals(servletName)) { result.add(urlPattern); } } return result; }
@Override public Set<String> addMapping(String... urlPatterns) { if (urlPatterns == null) { return Collections.emptySet(); } Set<String> conflicts = new HashSet<String>(); for (String urlPattern : urlPatterns) { if (context.findServletMapping(urlPattern) != null) { conflicts.add(urlPattern); } } if (!conflicts.isEmpty()) { return conflicts; } for (String urlPattern : urlPatterns) { context.addServletMapping(urlPattern, wrapper.getName()); } return Collections.emptySet(); }
@Override public Collection<String> getMappings() { Set<String> result = new HashSet<String>(); String servletName = wrapper.getName(); String[] urlPatterns = context.findServletMappings(); for (String urlPattern : urlPatterns) { String name = context.findServletMapping(urlPattern); if (name.equals(servletName)) { result.add(urlPattern); } } return result; }
@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 Collection<String> getMappings() { Set<String> result = new HashSet<>(); String servletName = wrapper.getName(); String[] urlPatterns = context.findServletMappings(); for (String urlPattern : urlPatterns) { String name = context.findServletMapping(urlPattern); if (name.equals(servletName)) { result.add(urlPattern); } } return result; }
@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 Collection<String> getMappings() { Set<String> result = new HashSet<>(); String servletName = wrapper.getName(); String[] urlPatterns = context.findServletMappings(); for (String urlPattern : urlPatterns) { String name = context.findServletMapping(urlPattern); if (name.equals(servletName)) { result.add(urlPattern); } } return result; }
@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 Collection<String> getMappings() { Set<String> result = new HashSet<String>(); String servletName = wrapper.getName(); String[] urlPatterns = context.findServletMappings(); for (String urlPattern : urlPatterns) { String name = context.findServletMapping(urlPattern); if (name.equals(servletName)) { result.add(urlPattern); } } return result; }
String wrapperName = context.findServletMapping(urlPattern); if (wrapperName != null) { Wrapper wrapper = (Wrapper) context.findChild(wrapperName);
@Override public Collection<String> getMappings() { Set<String> result = new HashSet<String>(); String servletName = wrapper.getName(); String[] urlPatterns = context.findServletMappings(); for (String urlPattern : urlPatterns) { String name = context.findServletMapping(urlPattern); if (name.equals(servletName)) { result.add(urlPattern); } } return result; }
String wrapperName = context.findServletMapping(urlPattern); if (wrapperName != null) { Wrapper wrapper = (Wrapper) context.findChild(wrapperName);
@Override public Collection<String> getMappings() { Set<String> result = new HashSet<String>(); String servletName = wrapper.getName(); String[] urlPatterns = context.findServletMappings(); for (String urlPattern : urlPatterns) { String name = context.findServletMapping(urlPattern); if (name.equals(servletName)) { result.add(urlPattern); } } return result; }
public Set<String> addMapping(String... urlPatterns) { Set<String> conflicts = new HashSet<String>(); if (!((Context) wrapper.getParent()).isStarting()) { throw new IllegalStateException(sm.getString ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath())); } if (urlPatterns == null || urlPatterns.length == 0) { throw new IllegalArgumentException(sm.getString("servletRegistration.iae")); } for (String urlPattern : urlPatterns) { if (((Context) wrapper.getParent()).findServletMapping(urlPattern) != null) { conflicts.add(urlPattern); } } if (conflicts.isEmpty()) { for (String urlPattern : urlPatterns) { ((Context) wrapper.getParent()).addServletMapping(urlPattern, wrapper.getName()); } } return conflicts; }
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; }
String jspServletName = context.findServletMapping("*.jsp"); if (jspServletName == null) { jspServletName = "jsp";