2017-02-24 81 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路徑。