How can I grab all query parameters in Jersey JaxRS?(如何获取 Jersey JaxRS 中的所有查询参数?)
问题描述
我正在构建一个通用 Web 服务,需要将所有查询参数抓取到一个字符串中以供以后解析.我该怎么做?
I am building a generic web service and need to grab all the query parameters into one string for later parsing. How can I do this?
推荐答案
您可以通过 @QueryParam("name")
访问单个参数或通过上下文访问所有参数:
You can access a single param via @QueryParam("name")
or all of the params via the context:
关键是 @Context
jax-rs注解,可用于访问:
The key is the @Context
jax-rs annotation, which can be used to access:
UriInfo、请求、HttpHeaders、安全上下文,提供者
UriInfo, Request, HttpHeaders, SecurityContext, Providers
这篇关于如何获取 Jersey JaxRS 中的所有查询参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!