简体   繁体   English

response.getStatusLine():HTTP / 1.1 400错误的请求

[英]response.getStatusLine():HTTP/1.1 400 Bad Request

I have passed date field as string into URL and date is encoded through URLEncoder.encode(date,"UTF-8") 我已将日期字段作为字符串传递给URL,并且日期通过URLEncoder.encode(date,“ UTF-8”)进行编码

generated Url is as below: 生成的网址如下:

    http://localhost:2990/jira/rest/issuesrestresource/1.0/message/RetrievessuesForUser/username/16%2FMay%2F13

But it does not able to call the rest resource service and giving me Bad request error as below. 但是它无法调用剩余资源服务,并给我以下错误请求错误。

response.getStatusLine():HTTP/1.1 400 Bad Request

what could be wrong and giving me bad request error..? 什么可能是错误的并给我错误的请求错误..? Thanks 谢谢

Try encoding the url instead of just date: 尝试编码网址,而不只是日期:

URLEncoder.encode(url,"UTF-8")

where url is your url string consisting date as well. 其中url是您的包含日期的url字符串。

Thanks for your comments. 感谢您的意见。

I just resolved by formatting the date as - "dd-MMM-yyyy" instead of 'dd/MMM/yyyy'. 我只是通过将日期格式设置为“ dd-MMM-yyyy”而不是“ dd / MMM / yyyy”来解决。 and it works fine. 而且效果很好。

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

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