You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/02/16 06:40:38 UTC
[camel] 04/04: CAMEL-16215: camel-undertow - Optimize isStatusCodeOk
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit a85c022bf83dd208cc9d33be665d94eb01feba10
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Feb 16 07:39:40 2021 +0100
CAMEL-16215: camel-undertow - Optimize isStatusCodeOk
---
.../camel/component/undertow/UndertowClientCallback.java | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowClientCallback.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowClientCallback.java
index f92c533..719a8d6 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowClientCallback.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowClientCallback.java
@@ -40,7 +40,6 @@ import io.undertow.util.HttpString;
import org.apache.camel.AsyncCallback;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
-import org.apache.camel.http.base.HttpHelper;
import org.apache.camel.http.base.HttpOperationFailedException;
import org.apache.camel.support.ExchangeHelper;
import org.slf4j.Logger;
@@ -88,22 +87,17 @@ class UndertowClientCallback implements ClientCallback<ClientConnection> {
private static final Logger LOG = LoggerFactory.getLogger(UndertowClientCallback.class);
- protected final UndertowEndpoint endpoint;
-
- protected final Exchange exchange;
-
- protected final ClientRequest request;
-
- protected final AsyncCallback callback;
-
/**
* A queue of resources that will be closed when the exchange ends, add more resources via
* {@link #deferClose(Closeable)}.
*/
protected final BlockingDeque<Closeable> closables = new LinkedBlockingDeque<>();
+ protected final UndertowEndpoint endpoint;
+ protected final Exchange exchange;
+ protected final ClientRequest request;
+ protected final AsyncCallback callback;
private final ByteBuffer body;
-
private final Boolean throwExceptionOnFailure;
UndertowClientCallback(final Exchange exchange, final AsyncCallback callback, final UndertowEndpoint endpoint,
@@ -209,7 +203,7 @@ class UndertowClientCallback implements ClientCallback<ClientConnection> {
final int code = clientExchange.getResponse().getResponseCode();
LOG.debug("Http responseCode: {}", code);
- final boolean ok = HttpHelper.isStatusCodeOk(code, "200-299");
+ final boolean ok = code >= 200 && code <= 299;
if (!ok && throwExceptionOnFailure) {
// operation failed so populate exception to throw
final String uri = endpoint.getHttpURI().toString();