[英]How can send multiple params on a get request
First of all, give thanks for reading my question and try to help me and apologize for my English. 首先,感谢您阅读我的问题,并尝试帮助我并为我的英语道歉。
I'm new with Spring and I have this message: 我是Spring的新手,并且收到以下消息:
A servlet request to the URI Servlet对URI的请求
http://localhost:8080/backend/v1/streetviewer/search-street?url=backend2?busqueda=name%20street&idioma=es-es%26cantidad=10
contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. 在请求正文中包含表单参数,但该请求正文已被servlet或访问请求参数的servlet过滤器使用。 Only resource methods using
@FormParam
will work as expected. 只有使用
@FormParam
资源方法@FormParam
按预期工作。 Resource methods consuming the request body by other means will not work as expected. 通过其他方式消耗请求主体的资源方法将无法正常工作。
My backend send a request to backend2 with one parameter (url), but that url contains 3 parameters. 我的后端使用一个参数(网址)向backend2发送了一个请求,但该网址包含3个参数。 I understand that is reason why say that.
我知道这就是为什么要这么说。
But I was reading that @FormParam
is used for POST requests and I'm using @QueryParam
. 但是我正在阅读
@FormParam
用于POST请求,而我正在使用@QueryParam
。
@GET
@Path(ApiPath.PATH_BACKEND2)
public String getDataFromProdServer(@QueryParam(ApiParam.PARAM_URL) final String externalUrl ) {
return mapService.ServerRequest(externalUrl);
}
How can solve it?? 怎么解决呢?
To be said you are actually using JAX-RS
Implementation, from backend2
I asume it is a separate service so I suggest you to use Spring Implementations for consuming the API. 可以说,您实际上是在使用
backend2
JAX-RS
实现,我backend2
它是一个单独的服务,所以我建议您使用Spring Implementations来使用该API。 @RequestMapping/@GetMapping and so..
Coming to the question (With Spring Implementation) 提出问题(使用Spring实施)
@GetMapping(ApiPath.PATH_BACKEND2)
public String getDataFromProdServer(@RequestParam(ApiParam.PARAM_UR) final String externalUrl) {
return mapService.serverRequest(externalUrl);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.