简体   繁体   English

在@BeanParam(JAX-RS,泽西岛)中获取所有表单参数

[英]Get all form parameters in a @BeanParam (JAX-RS, Jersey)

I'm trying to figure out if it's possible to get all the form parameters in a class that is annotated with @BeanParam for a REST endpoint. 我试图找出是否有可能在用@BeanParam注释的REST端点类中获取所有表单参数。

For example, I have an endpoint: 例如,我有一个端点:

   public void Response get(@BeanParam MyBeanClass bean) {
       ...
   } 

And I'd like to be able to get the Form parameters in MyBeanClass . 而且我希望能够在MyBeanClass获取Form参数。 I don't want to use @FormParam because that requires knowing what the parameters are ahead of time. 我不想使用@FormParam因为这需要提前知道什么参数。 I can't seem to figure out how to do this if it's even possible though. 即使有可能,我似乎也想不出该怎么做。 Is it? 是吗?

Thanks for the help. 谢谢您的帮助。

No, it is not possible to get form parameters using @BeanParam without @FormParam . 不,没有@BeanParam情况下, @FormParam使用@BeanParam获取表单参数。

@BeanParam is simply a parameter aggregator . @BeanParam只是一个参数聚合器 Besides @FormParam , it also supports @QueryParam , @PathParam , @HeaderParam , and even @Context annotations. 除了@FormParam之外,它还支持@QueryParam@PathParam@HeaderParam甚至@Context批注。

Offical docs: https://docs.oracle.com/javaee/7/api/index.html?javax/ws/rs/BeanParam.html 官方文档: https//docs.oracle.com/javaee/7/api/index.html? javax / ws / rs / Bean / Param.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM