简体   繁体   English

我在Internet Explorer中仅收到400错误的ReST呼叫请求

[英]I am getting 400 Bad Request for ReST call only in internet explorer

In our running application, one of GET request starts giving response as 400 Bad Request in Internet Explorer. 在我们正在运行的应用程序中, GET请求之一开始在Internet Explorer中作为400 Bad Request给出响应。

On investigating , I found that GET request doesn't have queryParameters what were expected by ReST call. 在调查中,我发现GET请求没有带有ReST调用所期望的queryParameters。

As it is giving response in another browsers like Chrome, Mozilla, how can I proceed further ? 当它在其他浏览器(例如Chrome,Mozilla)中给出响应时,我该如何继续?

this is Request currently being triggered-- 这是当前正在触发的请求-

Method of request is GET 请求的方法是GET

https://XXXXXXXXX/XXX/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX/XXXXXXXXX ?{%22numRecords%22:1000,%22start%22:0}&_=1487576597960 https:// XXXXXXXXX / XXX / XXXXXXXXX / XXXXXXXXX / XXXXXXXXX / XXXXXXXXX ?{%22numRecords%22:1000,%22start%22:0}&_ = 1487576597960

and queryParameters in @QueryParam expected by ReST api are- ReST api期望的@QueryParam中的queryParameter和-

-numRecords -start -numRecords-开始

I know by the above GET request, numRecords and start will not get captured by api backend. 我知道通过上述GET请求,numRecords和start不会被api后端捕获。

So , is there any chance, if my GET request lack of any @QueryParam will lead to 400 Bad request response. 因此,如果我的GET请求缺少任何@QueryParam ,是否有机会导致400错误的请求响应。

I found that GET request doesn't have queryParameters 我发现GET请求没有queryParameters

You can use query parameters in GET requests as you've provided in your example like this: http://host?queryParam1=value1 . 您可以在示例中提供的GET请求中使用查询参数,例如: http://host?queryParam1=value1 however it's not possible to pass a request body as you can do for POST or PUT requests to provide JSON encoded data for example. 但是,像传递POST或PUT请求以提供JSON编码数据一样,无法传递请求正文。 You can work around this by adding the JSON AND URL encoded payload to a query parameter. 您可以通过将JSON AND URL编码的有效负载添加到查询参数来解决此问题。 But you endpoint explicitely has to be able to read this parameter. 但是您的端点必须明确地能够读取此参数。 So you should add this parameter to your definiotn like in this example for JAX-RS: 因此,您应该像在本示例中的JAX-RS一样,将此参数添加到definiotn中:

@GET
@Path("my-endpoint")
public String request(
        @PathParam("payload") JsonObject payload
) {

What you've tried is to simply pass the payload data without specifing the name of the request parameter. 您尝试过的是简单地传递有效负载数据,而不指定请求参数的名称。

Hope this helps. 希望这可以帮助。

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

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