2017-02-24 58 views
3

我在创建'灵活'端点时遇到问题。沿着这些线路可能的东西:Perl催化剂控制器链

# 1) List all Microarrays for this species 
/regulatory/species/:species/microarray 
sub microarray_list: Chained('species') PathPart('microarray') ActionClass('REST') { } 

# 2) Information about a specific array 
/regulatory/species/:species/microarray/:microarray 
sub microarray_single: Chained('species') PathPart('microarray') CaptureArgs(1) ActionClass('REST') { } 

# 3) Information about a probe on the array 
/regulatory/species/:species/microarray/:microarray/probe/:probe 
sub microarray_probe: Chained('microarray_single') PathPart('probe') Args(1) ActionClass('REST') 

在启动1)未注册:

| /regulatory/species/*/id/*   | /regulatory/species (1)    | 
|          | => /regulatory/id (1)    | 
| /regulatory/species/*/microarray | /regulatory/species (1)    | 
|          | => /regulatory/microarray_list (...) | 
| /regulatory/species/*/microarray/*- | /regulatory/species (1)    | 
| /probe/*       | 

任何帮助应该不胜感激!

+1

Wheres the code? – 2017-02-24 09:26:20

+1

定义了“/ regulatory/species/*/id/*”在哪里? – simbabque

回答

3

是的,这是可能的,你的问题就是,你不必为microarray_single的端点。你可能想

sub microarray_list :Chained('species') PathPart('microarray') 
        ActionClass('REST') { } 

# this is the chain midpoint, it can load the microarray for the endpoints to use 
sub microarray :Chained('species') PathPart('microarray') 
       CaptureArgs(1) { } 

# this is an endpoint with the same path as the midpoint it chains off of 
sub microarray_single :Chained('microarray') PathPart('') 
         Args(0) ActionClass('REST') { } 

# and this is an endpoint that adds .../probe/* 
sub microarray_probe :Chained('microarray') PathPart('probe') 
         Args(1) ActionClass('REST') { } 

如果有其他的东西,可以来.../microarray/*/probe/*后,那么你就这样做,改变从Args(1) ActionClass('REST')(终点)microarray_probeCaptureArgs(1),然后加上一个端点:Chained('microarray_probe') PathPart('') Args(0) ActionClass('REST')来处理情况,有情况没有额外的路径部分。

要记住的重要一点是只有链端点(即没有0​​的动作)对应于有效的URL路径。