/**
  * Implements ResourceInterface::routes().
  */
 public function routes()
 {
     $collection = parent::routes();
     $path_prefix = strtr($this->pluginId, ':', '/');
     $route_name = strtr($this->pluginId, ':', '.');
     $methods = $this->getAnnotatedMethods();
     foreach ($methods as $method) {
         $lower_method = strtolower($method);
         $annotation = $this->getMethodAnnotation($method);
         $route = new Route('/' . $annotation['uri'], array('_controller' => 'Drupal\\services\\AnnotationRequestHandler::handle', '_plugin' => $this->pluginId), array('_method' => $annotation['httpMethod'], '_operation' => $method, '_permission' => 'access content'));
         $collection->add("{$route_name}.{$lower_method}", $route);
     }
     return $collection;
 }
 /**
  * {@inheritdoc}
  */
 public function routes()
 {
     $collection = parent::routes();
     // ResourceBase class has no support PUT method by some reason.
     $definition = $this->getPluginDefinition();
     $canonical_path = $definition['uri_paths']['canonical'];
     $route = $this->getBaseRoute($canonical_path, 'PUT');
     $route->addRequirements(array('_content_type_format' => implode('|', $this->serializerFormats)));
     $collection->add('example_foo.PUT', $route);
     return $collection;
 }