java jersey可变长度路径 [英] java jersey variable length paths
问题描述
反正在球衣中是否需要指定可变长度的路径?
Is there anyway to specify in jersey I want a variable length paths?
例如
我想实现处理例如以下网址:
I want to implement a jersey resouce that handles e.g. the following url:
/images/asdfu213/size;width=100;height=200/reflect;offset=2/rotate;angle=0.45/
这是一条可变长度的路径,因为用户可以在图像上附加其他操作,例如:
This is a variable length path as the user could append another operation on the image e.g.:
/images/asdfu213/size;width=100;height=200/reflect;offset=2/rotate;angle=0.45/shear;x=0.3/
球衣到底有没有实现这一目标的地方?
is there anyway in jersey to implement this?
我尝试过:
@Path("/{id}/{size}/{ops: .*}")
Response process(@PathParam("id)String id, @PathParam("size") PathSegment sizeSegment, @PathParam("op") PathSegment opsSegments)
但是所有矩阵参数都是条带化的,而opsSegments.getPath为空
but all the matrix params are striped, and opsSegments.getPath is empty
也尝试过
@Path("/{id}/{size}/{ops: .*}")
Response process(@PathParam("id")String id, @PathParam("size") PathSegment sizeSegment, @PathParam("op") String opsSegments)
尽管路径已保留,但所有矩阵参数均已剥离
although the path is preserved, all the matrix params are stripped
任何帮助将不胜感激.
推荐答案
对不起,找到了答案,
您可以具有 PathSegment
you can have a list of PathSegments like:
process(@PathParam("ops") List<PathSegment> ops)
球衣是很聪明的,可以为您处理.
and jersey is smart enough to handle that for you.
这是在api文档中!应该先阅读.
This is in the api doc! should have read it first.
这篇关于java jersey可变长度路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!