You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by du...@apache.org on 2024/06/28 15:03:27 UTC
(sling-org-apache-sling-testing-clients) branch master updated: SLING-12363 ServerErrorRetryStrategy throws ClassCastException for BasicHttpRequest (#49)
This is an automated email from the ASF dual-hosted git repository.
dulvac pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-clients.git
The following commit(s) were added to refs/heads/master by this push:
new d07305f SLING-12363 ServerErrorRetryStrategy throws ClassCastException for BasicHttpRequest (#49)
d07305f is described below
commit d07305fb69523a43856865c242d030290e81cf1d
Author: Mark Adamcin <ad...@users.noreply.github.com>
AuthorDate: Fri Jun 28 08:03:22 2024 -0700
SLING-12363 ServerErrorRetryStrategy throws ClassCastException for BasicHttpRequest (#49)
---
.../sling/testing/clients/util/ServerErrorRetryStrategy.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/sling/testing/clients/util/ServerErrorRetryStrategy.java b/src/main/java/org/apache/sling/testing/clients/util/ServerErrorRetryStrategy.java
index 2f8786a..44cdbd2 100644
--- a/src/main/java/org/apache/sling/testing/clients/util/ServerErrorRetryStrategy.java
+++ b/src/main/java/org/apache/sling/testing/clients/util/ServerErrorRetryStrategy.java
@@ -16,9 +16,9 @@
*/
package org.apache.sling.testing.clients.util;
+import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.client.ServiceUnavailableRetryStrategy;
-import org.apache.http.client.methods.HttpRequestWrapper;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
@@ -93,11 +93,11 @@ public class ServerErrorRetryStrategy implements ServiceUnavailableRetryStrategy
private String getRequestDetails(HttpContext context) {
String details = "Not available";
HttpClientContext clientContext = HttpClientContext.adapt(context);
- HttpRequestWrapper wrapper = clientContext.getAttribute(HttpClientContext.HTTP_REQUEST, HttpRequestWrapper.class);
- if (wrapper != null) {
+ HttpRequest request = clientContext.getRequest();
+ if (request != null) {
// Build a request detail string like following example:
// GET /test/internalerror/resource HTTP/1.1
- details = wrapper.getRequestLine().toString();
+ details = request.getRequestLine().toString();
}
return details;
}
@@ -109,7 +109,7 @@ public class ServerErrorRetryStrategy implements ServiceUnavailableRetryStrategy
String details = "Not available";
if (response != null) {
// Build a response string like following example:
- // HTTP/1.1 500 Internal Server Error [Date: Thu, 12 Jan 2023 08:32:42 GMT, Server: TEST/1.1,
+ // HTTP/1.1 500 Internal Server Error [Date: Thu, 12 Jan 2023 08:32:42 GMT, Server: TEST/1.1,
// Content-Length: 8, Content-Type: text/plain; charset=ISO-8859-1, Connection: Keep-Alive, ]
final StringBuilder sb = new StringBuilder(response.getStatusLine().toString());
sb.append(" [");