test_class.file: webapp/impl/src/test/java/cloud/piranha/webapp/impl/DefaultWebApplicationRequestMapperTest.java
test_class.identifier: DefaultWebApplicationRequestMapperTest
test_case.body: @Test
      void testFindExactServletMatch() throws Exception {
          DefaultWebApplicationRequestMapper webAppRequestMapper = new DefaultWebApplicationRequestMapper();
          DefaultWebApplication webApp = new DefaultWebApplication();
          webApp.setWebApplicationRequestMapper(webAppRequestMapper);
          webApp.addServlet("echo", new TestEcho1Servlet());
          webApp.addServletMapping("echo", "/echo");
          webApp.initialize();
          webApp.start();
          TestWebApplicationRequest request = new TestWebApplicationRequest();
          request.setServletPath("/echo");
          TestWebApplicationResponse response = new TestWebApplicationResponse();
          response.setBodyOnly(true);
          webApp.service(request, response);
          assertEquals("ECHO", new String(response.getResponseBytes()));
      }
test_case.class_method_signature: DefaultWebApplicationRequestMapperTest.testFindExactServletMatch()
test_case.full_signature: @Test void testFindExactServletMatch()
test_case.identifier: testFindExactServletMatch
test_case.invocations: setWebApplicationRequestMapper addServlet addServletMapping initialize start setServletPath setBodyOnly service assertEquals getResponseBytes
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFindExactServletMatch()
focal_class.declarator: filterMappings = new ArrayList<>()
focal_class.modifier: protected final
focal_class.original_string: protected final List<FilterMapping> filterMappings = new ArrayList<>();
focal_class.type: List<FilterMapping>
focal_class.var_name: filterMappings
focal_class.declarator: servletMappings = new ConcurrentHashMap<>()
focal_class.modifier: protected final
focal_class.original_string: protected final ConcurrentHashMap<String, String> servletMappings = new ConcurrentHashMap<>();
focal_class.type: ConcurrentHashMap<String, String>
focal_class.var_name: servletMappings
focal_class.file: webapp/impl/src/main/java/cloud/piranha/webapp/impl/DefaultWebApplicationRequestMapper.java
focal_class.identifier: DefaultWebApplicationRequestMapper
focal_class.interfaces: implements WebApplicationRequestMapper
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.addFilterMapping(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.full_signature: @Override public Set<String> addFilterMapping(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.identifier: addFilterMapping
focal_class.modifiers: @Override public
focal_class.parameters: (Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.return: Set<String>
focal_class.signature: Set<String> addFilterMapping(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.addFilterMappingBeforeExisting(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.full_signature: @Override public Set<String> addFilterMappingBeforeExisting(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.identifier: addFilterMappingBeforeExisting
focal_class.modifiers: @Override public
focal_class.parameters: (Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.return: Set<String>
focal_class.signature: Set<String> addFilterMappingBeforeExisting(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.addServletMapping(String servletName, String... urlPatterns)
focal_class.full_signature: @Override public Set<String> addServletMapping(String servletName, String... urlPatterns)
focal_class.identifier: addServletMapping
focal_class.modifiers: @Override public
focal_class.parameters: (String servletName, String... urlPatterns)
focal_class.return: Set<String>
focal_class.signature: Set<String> addServletMapping(String servletName, String... urlPatterns)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.findFilterMappings(DispatcherType dispatcherType, String path)
focal_class.full_signature: @Override public Collection<String> findFilterMappings(DispatcherType dispatcherType, String path)
focal_class.identifier: findFilterMappings
focal_class.modifiers: @Override public
focal_class.parameters: (DispatcherType dispatcherType, String path)
focal_class.return: Collection<String>
focal_class.signature: Collection<String> findFilterMappings(DispatcherType dispatcherType, String path)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.doAddFilterMapping(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.full_signature: private Set<String> doAddFilterMapping(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.identifier: doAddFilterMapping
focal_class.modifiers: private
focal_class.parameters: (Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.return: Set<String>
focal_class.signature: Set<String> doAddFilterMapping(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.doAddFilterMappingBeforeExisting(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.full_signature: private Set<String> doAddFilterMappingBeforeExisting(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.identifier: doAddFilterMappingBeforeExisting
focal_class.modifiers: private
focal_class.parameters: (Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.return: Set<String>
focal_class.signature: Set<String> doAddFilterMappingBeforeExisting(Set<DispatcherType> dispatcherTypes, String filterName, String... urlPatterns)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.findServletExactMatch(String path)
focal_class.full_signature: private DefaultWebApplicationRequestMapping findServletExactMatch(String path)
focal_class.identifier: findServletExactMatch
focal_class.modifiers: private
focal_class.parameters: (String path)
focal_class.return: DefaultWebApplicationRequestMapping
focal_class.signature: DefaultWebApplicationRequestMapping findServletExactMatch(String path)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.findServletExtensionMatch(String path)
focal_class.full_signature: private DefaultWebApplicationRequestMapping findServletExtensionMatch(String path)
focal_class.identifier: findServletExtensionMatch
focal_class.modifiers: private
focal_class.parameters: (String path)
focal_class.return: DefaultWebApplicationRequestMapping
focal_class.signature: DefaultWebApplicationRequestMapping findServletExtensionMatch(String path)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.findServletMapping(String path)
focal_class.full_signature: @Override public DefaultWebApplicationRequestMapping findServletMapping(String path)
focal_class.identifier: findServletMapping
focal_class.modifiers: @Override public
focal_class.parameters: (String path)
focal_class.return: DefaultWebApplicationRequestMapping
focal_class.signature: DefaultWebApplicationRequestMapping findServletMapping(String path)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.findServletPrefixMatch(String path)
focal_class.full_signature: private DefaultWebApplicationRequestMapping findServletPrefixMatch(String path)
focal_class.identifier: findServletPrefixMatch
focal_class.modifiers: private
focal_class.parameters: (String path)
focal_class.return: DefaultWebApplicationRequestMapping
focal_class.signature: DefaultWebApplicationRequestMapping findServletPrefixMatch(String path)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.findServletPrefixMatch(String path, DefaultWebApplicationRequestMapping currentPrefix)
focal_class.full_signature: private DefaultWebApplicationRequestMapping findServletPrefixMatch(String path, DefaultWebApplicationRequestMapping currentPrefix)
focal_class.identifier: findServletPrefixMatch
focal_class.modifiers: private
focal_class.parameters: (String path, DefaultWebApplicationRequestMapping currentPrefix)
focal_class.return: DefaultWebApplicationRequestMapping
focal_class.signature: DefaultWebApplicationRequestMapping findServletPrefixMatch(String path, DefaultWebApplicationRequestMapping currentPrefix)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.getServletMappings(String servletName)
focal_class.full_signature: @Override public Collection<String> getServletMappings(String servletName)
focal_class.identifier: getServletMappings
focal_class.modifiers: @Override public
focal_class.parameters: (String servletName)
focal_class.return: Collection<String>
focal_class.signature: Collection<String> getServletMappings(String servletName)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.getServletName(String mapping)
focal_class.full_signature: @Override public String getServletName(String mapping)
focal_class.identifier: getServletName
focal_class.modifiers: @Override public
focal_class.parameters: (String mapping)
focal_class.return: String
focal_class.signature: String getServletName(String mapping)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.isEmpty(Collection<?> collection)
focal_class.full_signature: private boolean isEmpty(Collection<?> collection)
focal_class.identifier: isEmpty
focal_class.modifiers: private
focal_class.parameters: (Collection<?> collection)
focal_class.return: boolean
focal_class.signature: boolean isEmpty(Collection<?> collection)
focal_class.class_method_signature: DefaultWebApplicationRequestMapper.isEmpty(String[] strings)
focal_class.full_signature: private boolean isEmpty(String[] strings)
focal_class.identifier: isEmpty
focal_class.modifiers: private
focal_class.parameters: (String[] strings)
focal_class.return: boolean
focal_class.signature: boolean isEmpty(String[] strings)
focal_method.body: @Override
      public Set<String> addServletMapping(String servletName, String... urlPatterns) {
          // Servlet:JAVADOC:696.3 - if urlPatterns is null or empty throw IllegalArgumentException
          if (isEmpty(urlPatterns)) {
              throw new IllegalArgumentException("Mappings for " + servletName + " cannot be empty");
          }
  
          // Servlet:JAVADOC:696.1 - If any of the specified URL patterns are already mapped to a different Servlet, no updates will be performed.
          Set<String> mappedToOtherServlet = stream(urlPatterns)
              .filter(servletMappings::containsKey)
              .filter(urlPattern -> !servletMappings.get(urlPattern).equals(servletName))
              .collect(toSet());
  
          if (!mappedToOtherServlet.isEmpty()) {
              return mappedToOtherServlet;
          }
  
          for (String urlPattern : urlPatterns) {
              servletMappings.put(urlPattern, servletName);
          }
  
          return emptySet();
      }
focal_method.class_method_signature: DefaultWebApplicationRequestMapper.addServletMapping(String servletName, String... urlPatterns)
focal_method.full_signature: @Override public Set<String> addServletMapping(String servletName, String... urlPatterns)
focal_method.identifier: addServletMapping
focal_method.invocations: isEmpty collect filter filter stream equals get toSet isEmpty put emptySet
focal_method.modifiers: @Override public
focal_method.parameters: (String servletName, String... urlPatterns)
focal_method.return: Set<String>
focal_method.signature: Set<String> addServletMapping(String servletName, String... urlPatterns)