Reputation: 422
I am using LaxRedirectStrategy in my httpclient 4.3.6 configutaion. After redirection inside DefaultRedirectStrategy class it is creating location inside createlocationURI method of DefaultRedirectStrategy class. There it is failing for this URL "/harborone0457/Profile%20-%20{0}.aspx" due to illegal character. 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
Upvotes: 0
Views: 1265
Reputation: 4122
The problem is that braces {
and }
needs to be encoded in order to form a valid URL:
{ = %7B
} = %7D
Full list on URI encoding is available here
Upvotes: 1