简体   繁体   English

Httpclient 4.3.6:无效的重定向URI

[英]Httpclient 4.3.6: Invalid redirect URI

I am using LaxRedirectStrategy in my httpclient 4.3.6 configutaion. 我在我的httpclient 4.3.6配置中使用LaxRedirectStrategy。 After redirection inside DefaultRedirectStrategy class it is creating location inside createlocationURI method of DefaultRedirectStrategy class. 在DefaultRedirectStrategy类内重定向之后,它正在DefaultRedirectStrategy类的createlocationURI方法内创建位置。 There it is failing for this URL "/harborone0457/Profile%20-%20{0}.aspx" due to illegal character. 由于非法字符,此URL“ /harborone0457/Profile%20-%20{0}.aspx”失败。 Any help how to solve it. 任何帮助如何解决它。 Below is the logs 以下是日志

Caused by: org.apache.http.ProtocolException: Invalid redirect URI: /harborone0457/Profile%20-%20{0}.aspx
at org.apache.http.impl.client.DefaultRedirectStrategy.createLocationURI(DefaultRedirectStrategy.java:197)
at org.apache.http.impl.client.DefaultRedirectStrategy.getLocationURI(DefaultRedirectStrategy.java:145)
at org.apache.http.impl.client.DefaultRedirectStrategy.getRedirect(DefaultRedirectStrategy.java:217)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:119)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
... 8 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 29: /harborone0457/Profile%20-%20{0}.aspx
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3105)
at java.net.URI$Parser.parse(URI.java:3063)
at java.net.URI.<init>(URI.java:588)
at org.apache.http.impl.client.DefaultRedirectStrategy.createLocationURI(DefaultRedirectStrategy.java:186)
... 15 more

The problem is that braces { and } needs to be encoded in order to form a valid URL: 问题是大括号{}需要编码才能形成有效的URL:

  {       =       %7B
  }       =      %7D

Full list on URI encoding is available here 此处提供有关URI编码的完整列表

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

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