gpt4 book ai didi

Perl Catalyst Controller 链

转载 作者:行者123 更新时间:2023-12-01 13:38:06 26 4
gpt4 key购买 nike

我在创建“灵活”端点时遇到问题。是否有可能沿着这些方向:

# 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/* |

任何帮助都将不胜感激!

最佳答案

是的,有可能,您的问题只是您没有 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/* 之后还有其他事情,那么您也可以这样做,将 microarray_probeArgs 更改为(1) ActionClass('REST') (endpoint) to CaptureArgs(1),然后用:Chained('microarray_probe') PathPart('') 添加一个端点Args(0) ActionClass('REST') 处理没有额外路径部分的情况。

要牢记的重要一点是,只有链 端点(即没有 CaptureArgs 的操作)对应于有效的 URL 路径。

关于Perl Catalyst Controller 链,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42433554/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com