test_class.declarator: thrown = ExpectedException.none()
test_class.modifier: @Rule public
test_class.original_string: @Rule public ExpectedException thrown = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: thrown
test_class.declarator: resources
test_class.modifier: private
test_class.original_string: private ResourceBinder     resources;
test_class.type: ResourceBinder
test_class.var_name: resources
test_class.declarator: request
test_class.modifier: private
test_class.original_string: private ContainerRequest   request;
test_class.type: ContainerRequest
test_class.var_name: request
test_class.declarator: response
test_class.modifier: private
test_class.original_string: private ContainerResponse  response;
test_class.type: ContainerResponse
test_class.var_name: response
test_class.declarator: applicationContext
test_class.modifier: private
test_class.original_string: private ApplicationContext applicationContext;
test_class.type: ApplicationContext
test_class.var_name: applicationContext
test_class.declarator: methodInvoker
test_class.modifier: private
test_class.original_string: private MethodInvoker      methodInvoker;
test_class.type: MethodInvoker
test_class.var_name: methodInvoker
test_class.declarator: pathParameterValues
test_class.modifier: private
test_class.original_string: private List<String>       pathParameterValues;
test_class.type: List<String>
test_class.var_name: pathParameterValues
test_class.declarator: requestDispatcher
test_class.modifier: private
test_class.original_string: private RequestDispatcher requestDispatcher;
test_class.type: RequestDispatcher
test_class.var_name: requestDispatcher
test_class.file: everrest-core/src/test/java/org/everrest/core/impl/RequestDispatcherTest.java
test_class.identifier: RequestDispatcherTest
test_case.body: @Test
      public void returnsResponseWithStatus_METHOD_NOT_ALLOWED_WhenNotFoundSubResourceMethodWithRequestedHttpMethod() throws Exception {
          when(applicationContext.getPathSegments(false)).thenReturn(createPathSegments("a", "b", "c", "d;x=y"));
  
          Resource resource = new Resource();
          SubResourceMethodDescriptor subResourceMethod =
                  mockSubResourceMethod(Resource.class.getMethod("echo", String.class), "c/d", "GET", newArrayList(WILDCARD_TYPE), newArrayList(WILDCARD_TYPE));
          ObjectFactory resourceFactory = mockResourceFactory(resource, newArrayList(), newArrayList(subResourceMethod), newArrayList());
  
          matchRequestPath("c/d");
          when(resources.getMatchedResource(eq("/a/b/c/d"), anyList())).thenReturn(resourceFactory);
  
          requestDispatcher.dispatch(request, response);
  
          ArgumentCaptor<Response> argumentCaptor = ArgumentCaptor.forClass(Response.class);
          verify(response).setResponse(argumentCaptor.capture());
          assertEquals(METHOD_NOT_ALLOWED, argumentCaptor.getValue().getStatusInfo());
          String allowHeader = argumentCaptor.getValue().getHeaderString(ALLOW);
          assertEquals("GET", allowHeader);
      }
test_case.class_method_signature: RequestDispatcherTest.returnsResponseWithStatus_METHOD_NOT_ALLOWED_WhenNotFoundSubResourceMethodWithRequestedHttpMethod()
test_case.full_signature: @Test public void returnsResponseWithStatus_METHOD_NOT_ALLOWED_WhenNotFoundSubResourceMethodWithRequestedHttpMethod()
test_case.identifier: returnsResponseWithStatus_METHOD_NOT_ALLOWED_WhenNotFoundSubResourceMethodWithRequestedHttpMethod
test_case.invocations: thenReturn when getPathSegments createPathSegments mockSubResourceMethod getMethod newArrayList newArrayList mockResourceFactory newArrayList newArrayList newArrayList matchRequestPath thenReturn when getMatchedResource eq anyList dispatch forClass setResponse verify capture assertEquals getStatusInfo getValue getHeaderString getValue assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void returnsResponseWithStatus_METHOD_NOT_ALLOWED_WhenNotFoundSubResourceMethodWithRequestedHttpMethod()
focal_class.declarator: LOG = LoggerFactory.getLogger(RequestDispatcher.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(RequestDispatcher.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: resourceBinder
focal_class.modifier: private final
focal_class.original_string: private final ResourceBinder resourceBinder;
focal_class.type: ResourceBinder
focal_class.var_name: resourceBinder
focal_class.declarator: locatorDescriptorCache
focal_class.modifier: private final
focal_class.original_string: private final LoadingCache<Class<?>, ResourceDescriptor> locatorDescriptorCache;
focal_class.type: LoadingCache<Class<?>, ResourceDescriptor>
focal_class.var_name: locatorDescriptorCache
focal_class.file: everrest-core/src/main/java/org/everrest/core/impl/RequestDispatcher.java
focal_class.identifier: RequestDispatcher
focal_class.class_method_signature: RequestDispatcher.RequestDispatcher(ResourceBinder resourceBinder)
focal_class.full_signature: public  RequestDispatcher(ResourceBinder resourceBinder)
focal_class.identifier: RequestDispatcher
focal_class.modifiers: public
focal_class.parameters: (ResourceBinder resourceBinder)
focal_class.signature:  RequestDispatcher(ResourceBinder resourceBinder)
focal_class.class_method_signature: RequestDispatcher.dispatch(GenericContainerRequest request, GenericContainerResponse response)
focal_class.full_signature: public void dispatch(GenericContainerRequest request, GenericContainerResponse response)
focal_class.identifier: dispatch
focal_class.modifiers: public
focal_class.parameters: (GenericContainerRequest request, GenericContainerResponse response)
focal_class.return: void
focal_class.signature: void dispatch(GenericContainerRequest request, GenericContainerResponse response)
focal_class.class_method_signature: RequestDispatcher.getResources()
focal_class.full_signature: public ResourceBinder getResources()
focal_class.identifier: getResources
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ResourceBinder
focal_class.signature: ResourceBinder getResources()
focal_class.class_method_signature: RequestDispatcher.getRequestPathWithoutMatrixParameters(ApplicationContext context)
focal_class.full_signature: private String getRequestPathWithoutMatrixParameters(ApplicationContext context)
focal_class.identifier: getRequestPathWithoutMatrixParameters
focal_class.modifiers: private
focal_class.parameters: (ApplicationContext context)
focal_class.return: String
focal_class.signature: String getRequestPathWithoutMatrixParameters(ApplicationContext context)
focal_class.class_method_signature: RequestDispatcher.getPathTail(List<String> parameterValues)
focal_class.full_signature: private String getPathTail(List<String> parameterValues)
focal_class.identifier: getPathTail
focal_class.modifiers: private
focal_class.parameters: (List<String> parameterValues)
focal_class.return: String
focal_class.signature: String getPathTail(List<String> parameterValues)
focal_class.class_method_signature: RequestDispatcher.dispatch(GenericContainerRequest request,
                            GenericContainerResponse response,
                            ApplicationContext context,
                            ResourceDescriptor resourceDescriptor,
                            Object resource,
                            String requestPath)
focal_class.full_signature: private void dispatch(GenericContainerRequest request,
                            GenericContainerResponse response,
                            ApplicationContext context,
                            ResourceDescriptor resourceDescriptor,
                            Object resource,
                            String requestPath)
focal_class.identifier: dispatch
focal_class.modifiers: private
focal_class.parameters: (GenericContainerRequest request,
                            GenericContainerResponse response,
                            ApplicationContext context,
                            ResourceDescriptor resourceDescriptor,
                            Object resource,
                            String requestPath)
focal_class.return: void
focal_class.signature: void dispatch(GenericContainerRequest request,
                            GenericContainerResponse response,
                            ApplicationContext context,
                            ResourceDescriptor resourceDescriptor,
                            Object resource,
                            String requestPath)
focal_class.class_method_signature: RequestDispatcher.invokeResourceMethod(ResourceMethodDescriptor resourceMethod,
                                        Object resource,
                                        ApplicationContext context,
                                        GenericContainerRequest request,
                                        GenericContainerResponse response)
focal_class.full_signature: private void invokeResourceMethod(ResourceMethodDescriptor resourceMethod,
                                        Object resource,
                                        ApplicationContext context,
                                        GenericContainerRequest request,
                                        GenericContainerResponse response)
focal_class.identifier: invokeResourceMethod
focal_class.modifiers: private
focal_class.parameters: (ResourceMethodDescriptor resourceMethod,
                                        Object resource,
                                        ApplicationContext context,
                                        GenericContainerRequest request,
                                        GenericContainerResponse response)
focal_class.return: void
focal_class.signature: void invokeResourceMethod(ResourceMethodDescriptor resourceMethod,
                                        Object resource,
                                        ApplicationContext context,
                                        GenericContainerRequest request,
                                        GenericContainerResponse response)
focal_class.class_method_signature: RequestDispatcher.invokeSubResourceMethod(String requestPath,
                                           SubResourceMethodDescriptor subResourceMethod,
                                           Object resource,
                                           ApplicationContext context,
                                           GenericContainerRequest request,
                                           GenericContainerResponse response)
focal_class.full_signature: private void invokeSubResourceMethod(String requestPath,
                                           SubResourceMethodDescriptor subResourceMethod,
                                           Object resource,
                                           ApplicationContext context,
                                           GenericContainerRequest request,
                                           GenericContainerResponse response)
focal_class.identifier: invokeSubResourceMethod
focal_class.modifiers: private
focal_class.parameters: (String requestPath,
                                           SubResourceMethodDescriptor subResourceMethod,
                                           Object resource,
                                           ApplicationContext context,
                                           GenericContainerRequest request,
                                           GenericContainerResponse response)
focal_class.return: void
focal_class.signature: void invokeSubResourceMethod(String requestPath,
                                           SubResourceMethodDescriptor subResourceMethod,
                                           Object resource,
                                           ApplicationContext context,
                                           GenericContainerRequest request,
                                           GenericContainerResponse response)
focal_class.class_method_signature: RequestDispatcher.doInvokeResource(ResourceMethodDescriptor method,
                                    Object resource,
                                    ApplicationContext context,
                                    GenericContainerRequest request,
                                    GenericContainerResponse response)
focal_class.full_signature: private void doInvokeResource(ResourceMethodDescriptor method,
                                    Object resource,
                                    ApplicationContext context,
                                    GenericContainerRequest request,
                                    GenericContainerResponse response)
focal_class.identifier: doInvokeResource
focal_class.modifiers: private
focal_class.parameters: (ResourceMethodDescriptor method,
                                    Object resource,
                                    ApplicationContext context,
                                    GenericContainerRequest request,
                                    GenericContainerResponse response)
focal_class.return: void
focal_class.signature: void doInvokeResource(ResourceMethodDescriptor method,
                                    Object resource,
                                    ApplicationContext context,
                                    GenericContainerRequest request,
                                    GenericContainerResponse response)
focal_class.class_method_signature: RequestDispatcher.invokeSubResourceLocator(String requestPath,
                                            SubResourceLocatorDescriptor subResourceLocator,
                                            Object resource,
                                            ApplicationContext context,
                                            GenericContainerRequest request,
                                            GenericContainerResponse response)
focal_class.full_signature: private void invokeSubResourceLocator(String requestPath,
                                            SubResourceLocatorDescriptor subResourceLocator,
                                            Object resource,
                                            ApplicationContext context,
                                            GenericContainerRequest request,
                                            GenericContainerResponse response)
focal_class.identifier: invokeSubResourceLocator
focal_class.modifiers: private
focal_class.parameters: (String requestPath,
                                            SubResourceLocatorDescriptor subResourceLocator,
                                            Object resource,
                                            ApplicationContext context,
                                            GenericContainerRequest request,
                                            GenericContainerResponse response)
focal_class.return: void
focal_class.signature: void invokeSubResourceLocator(String requestPath,
                                            SubResourceLocatorDescriptor subResourceLocator,
                                            Object resource,
                                            ApplicationContext context,
                                            GenericContainerRequest request,
                                            GenericContainerResponse response)
focal_class.class_method_signature: RequestDispatcher.compareSubResources(SubResourceMethodDescriptor subResourceMethod, SubResourceLocatorDescriptor subResourceLocator)
focal_class.full_signature: private int compareSubResources(SubResourceMethodDescriptor subResourceMethod, SubResourceLocatorDescriptor subResourceLocator)
focal_class.identifier: compareSubResources
focal_class.modifiers: private
focal_class.parameters: (SubResourceMethodDescriptor subResourceMethod, SubResourceLocatorDescriptor subResourceLocator)
focal_class.return: int
focal_class.signature: int compareSubResources(SubResourceMethodDescriptor subResourceMethod, SubResourceLocatorDescriptor subResourceLocator)
focal_class.class_method_signature: RequestDispatcher.processResponse(Object methodInvocationResult,
                                   GenericContainerRequest request,
                                   GenericContainerResponse response,
                                   List<MediaType> produces,
                                   ApplicationContext context)
focal_class.full_signature: private void processResponse(Object methodInvocationResult,
                                   GenericContainerRequest request,
                                   GenericContainerResponse response,
                                   List<MediaType> produces,
                                   ApplicationContext context)
focal_class.identifier: processResponse
focal_class.modifiers: private
focal_class.parameters: (Object methodInvocationResult,
                                   GenericContainerRequest request,
                                   GenericContainerResponse response,
                                   List<MediaType> produces,
                                   ApplicationContext context)
focal_class.return: void
focal_class.signature: void processResponse(Object methodInvocationResult,
                                   GenericContainerRequest request,
                                   GenericContainerResponse response,
                                   List<MediaType> produces,
                                   ApplicationContext context)
focal_class.class_method_signature: RequestDispatcher.processResourceMethod(Map<String, List<T>> resourceMethods,
                                                                                 GenericContainerRequest request,
                                                                                 GenericContainerResponse response,
                                                                                 List<T> matchedMethods)
focal_class.full_signature: private boolean processResourceMethod(Map<String, List<T>> resourceMethods,
                                                                                 GenericContainerRequest request,
                                                                                 GenericContainerResponse response,
                                                                                 List<T> matchedMethods)
focal_class.identifier: processResourceMethod
focal_class.modifiers: private
focal_class.parameters: (Map<String, List<T>> resourceMethods,
                                                                                 GenericContainerRequest request,
                                                                                 GenericContainerResponse response,
                                                                                 List<T> matchedMethods)
focal_class.return: boolean
focal_class.signature: boolean processResourceMethod(Map<String, List<T>> resourceMethods,
                                                                                 GenericContainerRequest request,
                                                                                 GenericContainerResponse response,
                                                                                 List<T> matchedMethods)
focal_class.class_method_signature: RequestDispatcher.byAcceptMediaTypeComparator(List<AcceptMediaType> acceptMediaTypes)
focal_class.full_signature: private Comparator<T> byAcceptMediaTypeComparator(List<AcceptMediaType> acceptMediaTypes)
focal_class.identifier: byAcceptMediaTypeComparator
focal_class.modifiers: private
focal_class.parameters: (List<AcceptMediaType> acceptMediaTypes)
focal_class.return: Comparator<T>
focal_class.signature: Comparator<T> byAcceptMediaTypeComparator(List<AcceptMediaType> acceptMediaTypes)
focal_class.class_method_signature: RequestDispatcher.notAcceptableFilter(List<AcceptMediaType> acceptMediaTypes)
focal_class.full_signature: private Predicate<T> notAcceptableFilter(List<AcceptMediaType> acceptMediaTypes)
focal_class.identifier: notAcceptableFilter
focal_class.modifiers: private
focal_class.parameters: (List<AcceptMediaType> acceptMediaTypes)
focal_class.return: Predicate<T>
focal_class.signature: Predicate<T> notAcceptableFilter(List<AcceptMediaType> acceptMediaTypes)
focal_class.class_method_signature: RequestDispatcher.getAllow(Map<String, List<T>> resourceMethods)
focal_class.full_signature: private Collection<String> getAllow(Map<String, List<T>> resourceMethods)
focal_class.identifier: getAllow
focal_class.modifiers: private
focal_class.parameters: (Map<String, List<T>> resourceMethods)
focal_class.return: Collection<String>
focal_class.signature: Collection<String> getAllow(Map<String, List<T>> resourceMethods)
focal_class.class_method_signature: RequestDispatcher.processSubResourceMethod(Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> subResourceMethods,
                                               String requestedPath,
                                               GenericContainerRequest request,
                                               GenericContainerResponse response,
                                               List<String> capturedValues,
                                               List<SubResourceMethodDescriptor> matchedMethods)
focal_class.full_signature: private boolean processSubResourceMethod(Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> subResourceMethods,
                                               String requestedPath,
                                               GenericContainerRequest request,
                                               GenericContainerResponse response,
                                               List<String> capturedValues,
                                               List<SubResourceMethodDescriptor> matchedMethods)
focal_class.identifier: processSubResourceMethod
focal_class.modifiers: private
focal_class.parameters: (Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> subResourceMethods,
                                               String requestedPath,
                                               GenericContainerRequest request,
                                               GenericContainerResponse response,
                                               List<String> capturedValues,
                                               List<SubResourceMethodDescriptor> matchedMethods)
focal_class.return: boolean
focal_class.signature: boolean processSubResourceMethod(Map<UriPattern, Map<String, List<SubResourceMethodDescriptor>>> subResourceMethods,
                                               String requestedPath,
                                               GenericContainerRequest request,
                                               GenericContainerResponse response,
                                               List<String> capturedValues,
                                               List<SubResourceMethodDescriptor> matchedMethods)
focal_class.class_method_signature: RequestDispatcher.processSubResourceLocator(Map<UriPattern, SubResourceLocatorDescriptor> subResourceLocators,
                                                String requestedPath,
                                                List<String> capturingValues,
                                                List<SubResourceLocatorDescriptor> locators)
focal_class.full_signature: private boolean processSubResourceLocator(Map<UriPattern, SubResourceLocatorDescriptor> subResourceLocators,
                                                String requestedPath,
                                                List<String> capturingValues,
                                                List<SubResourceLocatorDescriptor> locators)
focal_class.identifier: processSubResourceLocator
focal_class.modifiers: private
focal_class.parameters: (Map<UriPattern, SubResourceLocatorDescriptor> subResourceLocators,
                                                String requestedPath,
                                                List<String> capturingValues,
                                                List<SubResourceLocatorDescriptor> locators)
focal_class.return: boolean
focal_class.signature: boolean processSubResourceLocator(Map<UriPattern, SubResourceLocatorDescriptor> subResourceLocators,
                                                String requestedPath,
                                                List<String> capturingValues,
                                                List<SubResourceLocatorDescriptor> locators)
focal_class.class_method_signature: RequestDispatcher.getRootResource(List<String> parameterValues, String requestPath)
focal_class.full_signature: private ObjectFactory<ResourceDescriptor> getRootResource(List<String> parameterValues, String requestPath)
focal_class.identifier: getRootResource
focal_class.modifiers: private
focal_class.parameters: (List<String> parameterValues, String requestPath)
focal_class.return: ObjectFactory<ResourceDescriptor>
focal_class.signature: ObjectFactory<ResourceDescriptor> getRootResource(List<String> parameterValues, String requestPath)
focal_method.body: public void dispatch(GenericContainerRequest request, GenericContainerResponse response) {
          ApplicationContext context = ApplicationContext.getCurrent();
          String requestPath = getRequestPathWithoutMatrixParameters(context);
          List<String> parameterValues = context.getParameterValues();
  
          ObjectFactory<ResourceDescriptor> resourceFactory = getRootResource(parameterValues, requestPath);
          if (resourceFactory == null) {
              LOG.debug("Root resource not found for {}", requestPath);
              response.setResponse(Response.status(NOT_FOUND)
                                           .entity(String.format("There is no any resources matched to request path %s", requestPath))
                                           .type(TEXT_PLAIN)
                                           .build());
              return;
          }
  
          // Take the tail of the request path, the tail will be requested path
          // for lower resources, e. g. ResourceClass -> Sub-resource method/locator
          String newRequestPath = getPathTail(parameterValues);
          context.addMatchedURI(requestPath.substring(0, requestPath.lastIndexOf(newRequestPath)));
          context.setParameterNames(resourceFactory.getObjectModel().getUriPattern().getParameterNames());
  
          Object resource = resourceFactory.getInstance(context);
          dispatch(request, response, context, resourceFactory.getObjectModel(), resource, newRequestPath);
      }
focal_method.class_method_signature: RequestDispatcher.dispatch(GenericContainerRequest request, GenericContainerResponse response)
focal_method.full_signature: public void dispatch(GenericContainerRequest request, GenericContainerResponse response)
focal_method.identifier: dispatch
focal_method.invocations: getCurrent getRequestPathWithoutMatrixParameters getParameterValues getRootResource debug setResponse build type entity status format getPathTail addMatchedURI substring lastIndexOf setParameterNames getParameterNames getUriPattern getObjectModel getInstance dispatch getObjectModel
focal_method.modifiers: public
focal_method.parameters: (GenericContainerRequest request, GenericContainerResponse response)
focal_method.return: void
focal_method.signature: void dispatch(GenericContainerRequest request, GenericContainerResponse response)