本文介绍了使用矩阵参数创建GET请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将使用的网络服务需要矩阵参数:
The webservice I'll be using expects matrix parameters:
tester/v1/customers;lastname=Jackson;firstname=Tim;bookingreference=7Y9UIY而不是通常的
tester/v1/customers?lastname=Jackson&firstname=Tim&bookingreference=7Y9UIY无论如何,我可以使用Spring UriComponentsBuilder或其他方式创建请求吗?
Is there anyway I can create a request using the Spring UriComponentsBuilder or an alternative?
我知道我可以手动创建它,但希望有更精简的可用。
I'm aware that I could just create it manually but hoped there was something more streamlined available.
推荐答案UriBuilder 和 WebTarget 允许添加矩阵参数。
UriBuilder and WebTarget of JAX-RS allow to add matrix params.
UriBuilder builder = ... builder.matrixParam("lastname", "Jackson").matrixParam("firstname", "Tim")...更多推荐
使用矩阵参数创建GET请求
发布评论